Submission #14715

# Submission time Handle Problem Language Result Execution time Memory
14715 2015-06-13T02:17:05 Z baneling100 정전 (OJUZ10_blackout) C++
50 / 100
53 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);
    for(i=1 ; i<=N ; i++) scanf("%d",&Light[i]);
    sort(Light+1,Light+N+1);
    if(Light[1]-Light[2]+2*L>0) Res=Light[1]-Light[2]+2*L;
    for(i=3 ; i<=N ; i++) {
        if(Light[i-2]+L<Light[i]-L) {
            if(Light[i-1]-Light[i]+2*L>0) Res+=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 Incorrect 0 ms 1668 KB Output isn't 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
# 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 34 ms 1668 KB Output is correct
2 Correct 46 ms 1668 KB Output is correct
3 Correct 2 ms 1668 KB Output is correct
4 Correct 36 ms 1668 KB Output is correct
5 Correct 16 ms 1668 KB Output is correct
6 Correct 51 ms 1668 KB Output is correct
7 Correct 20 ms 1668 KB Output is correct
8 Correct 46 ms 1668 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 1668 KB Output is correct
2 Correct 13 ms 1668 KB Output is correct
3 Correct 20 ms 1668 KB Output is correct
4 Correct 17 ms 1668 KB Output is correct
5 Correct 32 ms 1668 KB Output is correct
6 Correct 28 ms 1668 KB Output is correct
7 Correct 2 ms 1668 KB Output is correct
8 Correct 34 ms 1668 KB Output is correct
9 Correct 44 ms 1668 KB Output is correct
10 Correct 53 ms 1668 KB Output is correct
11 Correct 53 ms 1668 KB Output is correct
12 Correct 44 ms 1668 KB Output is correct
13 Correct 44 ms 1668 KB Output is correct
14 Correct 28 ms 1668 KB Output is correct
15 Incorrect 43 ms 1668 KB Output isn't correct