Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 17 additions & 30 deletions Codechef/MAGICHF.c
Original file line number Diff line number Diff line change
@@ -1,36 +1,23 @@

/*
SEPTEMBER 2018 LONG CHALLENGE
link to the problem

https://www.codechef.com/SEPT18B/problems/MAGICHF/
*/

#include<stdio.h>
int main()
{
int N,X,S,T,A,B;
scanf("%d",&T);
while(T--)
{
scanf("%d%d%d",&N,&X,&S);
while(S--)
{
scanf("%d%d",&A,&B);
if(X==A)
{
X=B;
}
else if(X==B)
{
X=A;
}
int n,x,s,a,b,t;
scanf("%d",&t);
while(t--)
{
scanf("%d%d%d",&n,&x,&s);
while(s--)
{
scanf("%d%d", &a,&b);
if(a==x)
x=b;

}
else if(x==b)
x=a;

printf("%d\n",X);
}
printf("%d\n",x);
}

return 0;
}
return 0;
}


25 changes: 0 additions & 25 deletions Hackerrank/Sock Merchant.cpp

This file was deleted.