nitishch's blog

By nitishch, history, 11 years ago, In English

This is my submission to the problem 557B.

The only computation intensive thing I do is sort an array which can have atmost 10^5 entries. This is supposed to take < 1s. But I get TLE error if the array size is 10^5. Why does this happen?

  • Vote: I like it
  • +3
  • Vote: I do not like it

»
11 years ago, hide # |
 
Vote: I like it +21 Vote: I do not like it
int a[n];
  for (int i = 0; i < 2*n; i++) {
    cin >> a[i];
  }

Looks like you have problems with array size :)

»
11 years ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

Why does the use of a wrongly-sized array cause TLE and not runtime error?

It once happened to me as well. 7833244