CodeCrusader036's blog

By CodeCrusader036, history, 4 years ago, In English

when run my code in my codeblocks ide,it gives perfect ans.. but when I submit it it gives 'uninitiaized value usage' and wrong answere..

my submition:75769281

how can i solve this problem??

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

»
4 years ago, # |
  Vote: I like it -8 Vote: I do not like it

Here,I fixed it. https://codeforces.com/contest/1005/submission/75775687

You were doing a[k+1] so the upper bound should be k<n-1 not k<n(a[n] wasn't initialized)

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

for(int k=0;k<n;k++) when k = n-1, it's trying to access the data of a[n] inside if(a[k] >= a[k+1]). a[n] will show a garbage value unless you initialize it.