Hello I need some help about the problem 368B (link : http://codeforces.me/problemset/problem/368/B) My solution is : http://codeforces.me/contest/368/submission/14799431
and it works perfectly on codeblocks but giving wrong answer in Codeforces. Can anyone please explain why ? Thanks in advance.









ios_base::sync_with_stdio(0)and then mixcinwithscanf. That's exactly why synchronization is enabled by default in the first place: to allow you to use them simultaneously. You should either avoid disabling synchronization at all or stick tocinorscanfonly in your solution.int x[] = { 0 }does not do what you think it does — it only specifies the first element to be zero, and the remaining elements to be default values for int (which happens to be zero). Example. Note that local variables and arrays of primitive types are not guaranteed to be filled with zeros, soint x[] = {}andint x[]are different (the first one fills array with zeros, the second does not). However, when variables/arrays of primitive types are declared global, they are guaranteed to be zero-initialized after the program starts.