Submission #13973

# Submission time Handle Problem Language Result Execution time Memory
13973 2015-04-24T17:14:10 Z kriii 정전 (OJUZ10_blackout) C++14
100 / 100
51 ms 1668 KB
#include <stdio.h>
#include <algorithm>
using namespace std;

int N,L,X[150005];

int main()
{
	scanf ("%d %d",&N,&L);
	for (int i=0;i<N;i++) scanf ("%d",&X[i]);
	sort(X,X+N);

	int al = 0x80000000, bl = 0x80000000;
	long long ans = 0;
	for (int i=0;i<N;i++){
		if (i % 2){
			int s = X[i] - L;
			if (al >= s) s = al;
			if (s <= bl) ans += bl - s;
			al = X[i] + L;
		}
		else{
			int s = X[i] - L;
			if (bl >= s) s = bl;
			if (s <= al) ans += al - s;
			bl = X[i] + L;
		}
	}
	printf ("%lld\n",ans);

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1668 KB Output is correct
2 Correct 0 ms 1668 KB Output is correct
3 Correct 0 ms 1668 KB Output is correct
4 Correct 0 ms 1668 KB Output is correct
5 Correct 0 ms 1668 KB Output is correct
6 Correct 0 ms 1668 KB Output is correct
7 Correct 0 ms 1668 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1668 KB Output is correct
2 Correct 0 ms 1668 KB Output is correct
3 Correct 0 ms 1668 KB Output is correct
4 Correct 0 ms 1668 KB Output is correct
5 Correct 0 ms 1668 KB Output is correct
6 Correct 0 ms 1668 KB Output is correct
7 Correct 0 ms 1668 KB Output is correct
8 Correct 0 ms 1668 KB Output is correct
9 Correct 0 ms 1668 KB Output is correct
10 Correct 0 ms 1668 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 1668 KB Output is correct
2 Correct 0 ms 1668 KB Output is correct
3 Correct 32 ms 1668 KB Output is correct
4 Correct 49 ms 1668 KB Output is correct
5 Correct 41 ms 1668 KB Output is correct
6 Correct 23 ms 1668 KB Output is correct
7 Correct 31 ms 1668 KB Output is correct
8 Correct 28 ms 1668 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 38 ms 1668 KB Output is correct
2 Correct 50 ms 1668 KB Output is correct
3 Correct 35 ms 1668 KB Output is correct
4 Correct 23 ms 1668 KB Output is correct
5 Correct 51 ms 1668 KB Output is correct
6 Correct 38 ms 1668 KB Output is correct
7 Correct 39 ms 1668 KB Output is correct
8 Correct 34 ms 1668 KB Output is correct
9 Correct 43 ms 1668 KB Output is correct
10 Correct 9 ms 1668 KB Output is correct
11 Correct 45 ms 1668 KB Output is correct
12 Correct 33 ms 1668 KB Output is correct
13 Correct 1 ms 1668 KB Output is correct
14 Correct 30 ms 1668 KB Output is correct
15 Correct 23 ms 1668 KB Output is correct