Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

Problem hidden ?

NINJAREV4 - FOUR

no tags 

Debug the following code:

 

#include<iostream>

#include<cstring>

#include<vector>

using namespace std;

void x(int a,int b);

bool z(int a,int b);

int y(int a);

vector<int>p(10,17);

int main()

{

int n,a,b;

cin>>n;

for(int i=0;i<n;i++)

{

cin>>a>>b;

x(a,b);

}

cin>>a>>b;

if(z(a,b))

cout<<"true";

else

cout<<"false";

}

void x(int a,int b)

{

int aa=y(a);

int bb=y(b);

p[a]=bb;

p[b]=aa;

}

bool z(int a,int b)

{

if(y(a)==y(b))

return true;

else

return false;

}

int y(int a)

{

if(p[a]==65536)

return a;

else

{

return y(a-1);

}

}

 

Input :

 

First line indicates the no: of elements in an array. Second line denotes the elements of the array

 

Output:

Either true or false

 

Sample input:

2
3
86 77
15 93
35 86
2 9
1
62 27
0 9
Sample output:
false
false

Added by:mombassa
Date:2016-02-18
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 GOSU JS-MONKEY