nik7's blog

By nik7, history, 4 weeks ago, In English,

I have made this submission for this problem. It is giving correct answer for every small input in the test cases on my machine. But it is giving WA for the very first test case along with some runtime error. Can someone please help me figure out what's happening

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

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

when you create bool vis[n + 1], it fills with true values on Codeforces. So probably on your computer it fills with false values.

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

you forgot to initialise the vis array to zero it may possible that your system is always taking zero by default but the cf compiler does not do the same.
I made a single line modification to your code link1 or other on link2 but till my knowledge the second one work only for zero's.