tyagi's blog

By tyagi, 11 years ago, In English

I came across a weird situation .When i submit a solution to this problem in C++,it gives WRONG ANSWER on test case 4, While the same solution in C is ACCEPTED by the system. After debugging the solution i found that there was some problem while taking input of 2nd array od[](order array). The sequence in which input is being fed and the sequence which is stored in od[] array are completely different for test case 4(I found this by printing first few elements of od[] array for test case 4 i.e. n=500). It would be very helpful if someone could point out the mistake.

Question link: http://mirror.codeforces.com/problemset/problem/500/C

My solution in C++: https://ideone.com/l9otVc

Solution in C : https://ideone.com/xbwRr6

Full text and comments »

  • Vote: I like it
  • -4
  • Vote: I do not like it