답안 #13943

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
13943 2015-04-24T10:05:12 Z imsifile 정전 (OJUZ10_blackout) C++
30 / 100
73 ms 3428 KB
#include<stdio.h>
#include<algorithm>
using namespace std;

struct intv {
	int x, ad;
	bool operator< (const intv& c) const {
		if(x != c.x)return x<c.x;
		return ad<c.ad;
	}
}ba[300300];

int n, l, t;
long long sum;

int main(){
	int i, a, pv;
	scanf("%d%d", &n, &l);
	for(i=0; i<n; i++){
		scanf("%d", &a);
		ba[2*i].x=a-l, ba[2*i].ad=1;
		ba[2*i+1].x=a+l, ba[2*i+1].ad=-1;
	}
	sort(ba, ba+2*n);
	for(i=0; i<2*n; i++){
		if(i>0 && t>=2)sum+=ba[i].x-ba[i-1].x;
		t+=ba[i].ad;
		if(t>=3)sum--;
	}
	printf("%lld", sum);
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 3428 KB Output isn't correct
2 Correct 0 ms 3428 KB Output is correct
3 Incorrect 0 ms 3428 KB Output isn't correct
4 Correct 0 ms 3428 KB Output is correct
5 Correct 0 ms 3428 KB Output is correct
6 Incorrect 0 ms 3428 KB Output isn't correct
7 Incorrect 0 ms 3428 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 3428 KB Output isn't correct
2 Incorrect 0 ms 3428 KB Output isn't correct
3 Incorrect 0 ms 3428 KB Output isn't correct
4 Incorrect 0 ms 3428 KB Output isn't correct
5 Incorrect 0 ms 3428 KB Output isn't correct
6 Incorrect 0 ms 3428 KB Output isn't correct
7 Incorrect 0 ms 3428 KB Output isn't correct
8 Incorrect 0 ms 3428 KB Output isn't correct
9 Incorrect 0 ms 3428 KB Output isn't correct
10 Incorrect 0 ms 3428 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 3428 KB Output is correct
2 Correct 65 ms 3428 KB Output is correct
3 Correct 45 ms 3428 KB Output is correct
4 Correct 28 ms 3428 KB Output is correct
5 Correct 66 ms 3428 KB Output is correct
6 Correct 58 ms 3428 KB Output is correct
7 Correct 4 ms 3428 KB Output is correct
8 Correct 37 ms 3428 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 42 ms 3428 KB Output isn't correct
2 Incorrect 38 ms 3428 KB Output isn't correct
3 Incorrect 73 ms 3428 KB Output isn't correct
4 Incorrect 37 ms 3428 KB Output isn't correct
5 Incorrect 41 ms 3428 KB Output isn't correct
6 Incorrect 72 ms 3428 KB Output isn't correct
7 Incorrect 71 ms 3428 KB Output isn't correct
8 Incorrect 28 ms 3428 KB Output isn't correct
9 Incorrect 25 ms 3428 KB Output isn't correct
10 Incorrect 72 ms 3428 KB Output isn't correct
11 Incorrect 44 ms 3428 KB Output isn't correct
12 Incorrect 65 ms 3428 KB Output isn't correct
13 Incorrect 66 ms 3428 KB Output isn't correct
14 Incorrect 4 ms 3428 KB Output isn't correct
15 Incorrect 61 ms 3428 KB Output isn't correct