← Back to topics
Topic

z-photo

A
Amtrix
Can anyone give me some tricky test cases so that i can find the bug in my code, or maybe change my solution??? I solved the problem but I didn't pass any test cases . . . But every test case i create works fine :S
A
Amtrix
Well i see that no one answers...
So i explain my idea:
Pic1:
i[1] i[2] i[3]
i[4] i[5] i[6]
i[7] i[8] i[9]

pic2:
j[1] j[2] j[3]
j[4] j[5] j[6]
j[7] j[8] j[9]
( i[index] and j[index] represent the numbers of the picture )

Now i take the most down-right number of the first picture ( i[9] ) and see all locations of the number i[9] in the second picture... All positions that i found i save in a vector<coord>Locations;
Then i sort Locations with this compare function:


bool SortByXY( coord A, coord B ){
return ( A.x>B.x || (A.x==B.x && A.y>B.y) );
}


So that I can assume that the first valid found coord is the result . . .

And then I let the code check every coord from Location[0] to Location[n-1]. And the first valid coord is the result then output the result on this way:


printf("%d %d\n",n-mogucni[i].x-1,n-mogucni[i].y-1 );

Where mogucni = our locations.
Now I search for a test case where my solution fails , so that I can solve this problem... Maybe i don't understand the task and need to change my solution :D

EDIT:
here is my solution ( 0 TC passes :P )

http://www.z-trening.com/new/www/html/submit.php?submit=7100029320&subm_code=1