How can the same code gap be so great?

Правка en1, от justarandomstring, 2017-09-19 06:54:50

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 Sum, v[MAXN], ans[MAXN];

...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.

Теги c++

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский justarandomstring 2017-09-19 06:56:21 38
en1 Английский justarandomstring 2017-09-19 06:54:50 867 Initial revision (published)