Submission #14716

# Submission time Handle Problem Language Result Execution time Memory
14716 2015-06-13T02:18:57 Z baneling100 정전 (OJUZ10_blackout) C++
50 / 100
52 ms 1668 KB
#include <stdio.h>
#include <algorithm>
#define N_MAX 150000
#define INF 0x7fffffff

using namespace std;

int N, L, Light[N_MAX+1], Res;

int main(void) {

    int i;

    scanf("%d %d",&N,&L);
    if(N==1) {
        printf("0");
        return 0;
    }
    for(i=1 ; i<=N ; i++) scanf("%d",&Light[i]);
    sort(Light+1,Light+N+1);
    if((long long)Light[1]-Light[2]+2*L>0) Res=(long long)Light[1]-Light[2]+2*L;
    for(i=3 ; i<=N ; i++) {
        if(Light[i-2]+L<Light[i]-L) {
            if((long long)Light[i-1]-Light[i]+2*L>0) Res+=(long long)Light[i-1]-Light[i]+2*L;
        }
        else Res+=Light[i-1]-Light[i-2];
    }
    printf("%d",Res);

    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 Incorrect 0 ms 1668 KB Output isn't 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 40 ms 1668 KB Output is correct
2 Correct 16 ms 1668 KB Output is correct
3 Correct 32 ms 1668 KB Output is correct
4 Correct 51 ms 1668 KB Output is correct
5 Correct 3 ms 1668 KB Output is correct
6 Correct 40 ms 1668 KB Output is correct
7 Correct 13 ms 1668 KB Output is correct
8 Correct 25 ms 1668 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 1668 KB Output is correct
2 Correct 0 ms 1668 KB Output is correct
3 Correct 27 ms 1668 KB Output is correct
4 Correct 51 ms 1668 KB Output is correct
5 Correct 51 ms 1668 KB Output is correct
6 Correct 52 ms 1668 KB Output is correct
7 Correct 37 ms 1668 KB Output is correct
8 Correct 20 ms 1668 KB Output is correct
9 Correct 38 ms 1668 KB Output is correct
10 Incorrect 50 ms 1668 KB Output isn't correct
11 Correct 51 ms 1668 KB Output is correct
12 Correct 31 ms 1668 KB Output is correct
13 Correct 34 ms 1668 KB Output is correct
14 Correct 13 ms 1668 KB Output is correct
15 Correct 32 ms 1668 KB Output is correct