답안 #14395

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
14395 2015-05-14T01:30:06 Z pjsdream 정전 (OJUZ10_blackout) C++
100 / 100
51 ms 2256 KB
#include <stdio.h>
#include <algorithm>
long long a[150005], ans;
int main(){
	int n; long long L;
	scanf("%d %lld", &n, &L);
	for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
	std::sort(a, a + n);
	long long x = a[0] + L, s = a[0] - L;
	for (int i = 1; i < n; i++){
		if(a[i] - L > s) s = a[i] - L;
		if (s <= x){
			ans += (x - s);
			s = x;
		}
		x = a[i] + L;
	}
	printf("%lld", ans);
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2256 KB Output is correct
2 Correct 0 ms 2256 KB Output is correct
3 Correct 0 ms 2256 KB Output is correct
4 Correct 0 ms 2256 KB Output is correct
5 Correct 0 ms 2256 KB Output is correct
6 Correct 0 ms 2256 KB Output is correct
7 Correct 0 ms 2256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2256 KB Output is correct
2 Correct 0 ms 2256 KB Output is correct
3 Correct 0 ms 2256 KB Output is correct
4 Correct 0 ms 2256 KB Output is correct
5 Correct 0 ms 2256 KB Output is correct
6 Correct 0 ms 2256 KB Output is correct
7 Correct 0 ms 2256 KB Output is correct
8 Correct 0 ms 2256 KB Output is correct
9 Correct 0 ms 2256 KB Output is correct
10 Correct 0 ms 2256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 2256 KB Output is correct
2 Correct 3 ms 2256 KB Output is correct
3 Correct 32 ms 2256 KB Output is correct
4 Correct 44 ms 2256 KB Output is correct
5 Correct 50 ms 2256 KB Output is correct
6 Correct 31 ms 2256 KB Output is correct
7 Correct 25 ms 2256 KB Output is correct
8 Correct 31 ms 2256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 2256 KB Output is correct
2 Correct 28 ms 2256 KB Output is correct
3 Correct 51 ms 2256 KB Output is correct
4 Correct 38 ms 2256 KB Output is correct
5 Correct 28 ms 2256 KB Output is correct
6 Correct 51 ms 2256 KB Output is correct
7 Correct 27 ms 2256 KB Output is correct
8 Correct 32 ms 2256 KB Output is correct
9 Correct 33 ms 2256 KB Output is correct
10 Correct 23 ms 2256 KB Output is correct
11 Correct 38 ms 2256 KB Output is correct
12 Correct 39 ms 2256 KB Output is correct
13 Correct 0 ms 2256 KB Output is correct
14 Correct 44 ms 2256 KB Output is correct
15 Correct 13 ms 2256 KB Output is correct