Submission #5009

# Submission time Handle Problem Language Result Execution time Memory
5009 2014-01-26T06:10:56 Z ainta Global Warming (NOI13_gw) C++
40 / 40
284 ms 8940 KB
#include<stdio.h>
#include<algorithm>
using namespace std;
int n, i, a, b, w[2010000], c, S, R;
int main()
{
	scanf("%d", &n);
	b = 0;
	for (i = 1; i <= n; i++){
		scanf("%d", &a);
		if (a > b)w[c++] = b * 2, w[c++] = a * 2 - 1;
		b = a;
	}
	sort(w, w + c);
	for (i = 0; i < c; i++){
		S += (w[i] & 1) ? -1 : 1;
		if (R < S)R = S;
	}
	printf("%d\n", R);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 8940 KB Output is correct
2 Correct 0 ms 8940 KB Output is correct
3 Correct 0 ms 8940 KB Output is correct
4 Correct 0 ms 8940 KB Output is correct
5 Correct 0 ms 8940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 8940 KB Output is correct
2 Correct 16 ms 8940 KB Output is correct
3 Correct 12 ms 8940 KB Output is correct
4 Correct 16 ms 8940 KB Output is correct
5 Correct 16 ms 8940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 8940 KB Output is correct
2 Correct 24 ms 8940 KB Output is correct
3 Correct 24 ms 8940 KB Output is correct
4 Correct 24 ms 8940 KB Output is correct
5 Correct 24 ms 8940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 276 ms 8940 KB Output is correct
2 Correct 268 ms 8940 KB Output is correct
3 Correct 284 ms 8940 KB Output is correct
4 Correct 284 ms 8940 KB Output is correct
5 Correct 264 ms 8940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 276 ms 8940 KB Output is correct
2 Correct 272 ms 8940 KB Output is correct
3 Correct 260 ms 8940 KB Output is correct
4 Correct 168 ms 8940 KB Output is correct
5 Correct 164 ms 8940 KB Output is correct