nitishch's blog

By nitishch, history, 9 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

»
9 years ago, # |
  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 :)

»
9 years ago, # |
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

  • »
    »
    9 years ago, # ^ |
      Vote: I like it +4 Vote: I do not like it

    the right question is "why not?" in cases with UB like this.