답안 #14394

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
14394 2015-05-14T01:29:22 Z pjsdream 정전 (OJUZ10_blackout) C++
50 / 100
52 ms 1668 KB
#include <stdio.h>
#include <algorithm>
int a[150005], ans;
int main(){
	int n, L;
	scanf("%d %d", &n, &L);
	for (int i = 0; i < n; i++) scanf("%d", &a[i]);
	std::sort(a, a + n);
	int 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("%d", ans);
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1668 KB Output is correct
2 Correct 0 ms 1668 KB Output is correct
3 Incorrect 0 ms 1668 KB Output isn't 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
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 1668 KB Output is correct
2 Correct 33 ms 1668 KB Output is correct
3 Correct 20 ms 1668 KB Output is correct
4 Correct 0 ms 1668 KB Output is correct
5 Correct 46 ms 1668 KB Output is correct
6 Correct 31 ms 1668 KB Output is correct
7 Correct 52 ms 1668 KB Output is correct
8 Correct 28 ms 1668 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1668 KB Output is correct
2 Correct 26 ms 1668 KB Output is correct
3 Correct 51 ms 1668 KB Output is correct
4 Correct 40 ms 1668 KB Output is correct
5 Correct 29 ms 1668 KB Output is correct
6 Correct 23 ms 1668 KB Output is correct
7 Correct 33 ms 1668 KB Output is correct
8 Correct 21 ms 1668 KB Output is correct
9 Incorrect 43 ms 1668 KB Output isn't correct
10 Correct 39 ms 1668 KB Output is correct
11 Correct 26 ms 1668 KB Output is correct
12 Correct 35 ms 1668 KB Output is correct
13 Correct 39 ms 1668 KB Output is correct
14 Correct 42 ms 1668 KB Output is correct
15 Correct 44 ms 1668 KB Output is correct