justarandomstring's blog

By justarandomstring, history, 7 years ago, In English

It wasn't the first or second time I had this problem, so I couldn't help asking what was going on.

Today, I had a strange problem when I submitted this question 600E - Lomsat gelral

First, I submitted this code:

The full code is here: My TLE code

// ...Omitted...
long long Sum, v[MAXN], ans[MAXN];
// ...Omitted...

and got TLE(used more than 2000ms).

After a long inspection, I didn't find any problems, so I wrote it again. The new code is:

The full code is here: My AC code

// ...Omitted...
long long ans[MAXN], v[MAXN], Sum;
// ...Omitted...

ans got AC(only used 140ms).

The omission of the two code is exactly the same, and the result is too different!

I wonder what really happened.

Thanks.

Full text and comments »

Tags c++