답안 #14135

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
14135 2015-05-02T07:59:31 Z juchan1220 정전 (OJUZ10_blackout) C++
50 / 100
51 ms 1668 KB
#include <stdio.h>
#include <algorithm>
using namespace std;
int lamp[150001],n,l;
int main (void)
{
    int i,cnt=0;

    scanf("%d %d",&n,&l);

    for(i=0;i<n;i++){
        scanf("%d",&lamp[i]);
    }

    sort(lamp,lamp+n);

    for(i=1;i<n;i++){
        if(lamp[i-1]+l>lamp[i]-l)
            cnt+=lamp[i-1]+l-(lamp[i]-l);
        if(i>=2 && lamp[i-2]+l>lamp[i]-l)
            cnt-=lamp[i-2]+l-(lamp[i]-l);
        //printf("%d\n",cnt);
    }

    printf("%d\n",cnt);
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 1668 KB Output isn't 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
# 결과 실행 시간 메모리 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 45 ms 1668 KB Output is correct
2 Correct 48 ms 1668 KB Output is correct
3 Correct 14 ms 1668 KB Output is correct
4 Correct 31 ms 1668 KB Output is correct
5 Correct 50 ms 1668 KB Output is correct
6 Correct 29 ms 1668 KB Output is correct
7 Correct 3 ms 1668 KB Output is correct
8 Correct 33 ms 1668 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 44 ms 1668 KB Output is correct
2 Correct 26 ms 1668 KB Output is correct
3 Correct 33 ms 1668 KB Output is correct
4 Correct 38 ms 1668 KB Output is correct
5 Correct 33 ms 1668 KB Output is correct
6 Correct 35 ms 1668 KB Output is correct
7 Correct 0 ms 1668 KB Output is correct
8 Correct 49 ms 1668 KB Output is correct
9 Incorrect 51 ms 1668 KB Output isn't correct
10 Correct 17 ms 1668 KB Output is correct
11 Correct 41 ms 1668 KB Output is correct
12 Correct 15 ms 1668 KB Output is correct
13 Correct 32 ms 1668 KB Output is correct
14 Correct 38 ms 1668 KB Output is correct
15 Correct 24 ms 1668 KB Output is correct