Submission #14456

# Submission time Handle Problem Language Result Execution time Memory
14456 2015-05-17T08:13:03 Z yys980 정전 (OJUZ10_blackout) C++
50 / 100
48 ms 5772 KB
#include <stdio.h>
#include <algorithm>
using namespace std;
int n,l,sum;
int slight[300000],elight[300000];
int allight[300000][2],acnt;
int main()
{
    scanf("%d %d",&n, &l);
    int i;
    for(i = 1 ; i <= n ; i++){
        scanf("%d",&slight[i]);
        slight[i]-=l;
    }
    sort(slight+1,slight+1+n);
    for(i = 1 ; i <= n ; i++){
        elight[i]=slight[i]+l*2;
    }
    for(i = 1 ; i < n ; i++){
        if(slight[i+1] >= elight[i])continue;
        allight[acnt][0]=slight[i+1];
        allight[acnt][1]=elight[i];
        if(acnt>=1 && allight[acnt][0]<=allight[acnt-1][1]){
            allight[acnt-1][1]=allight[acnt][1];
            allight[acnt][0]=allight[acnt][1]=0;
        }
        else acnt++;
    }
    for(i = 0 ; i < acnt ; i++){
        sum+=(allight[i][1]-allight[i][0]);
    }
    printf("%d",sum);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5772 KB Output is correct
2 Correct 0 ms 5772 KB Output is correct
3 Correct 0 ms 5772 KB Output is correct
4 Correct 0 ms 5772 KB Output is correct
5 Correct 0 ms 5772 KB Output is correct
6 Correct 0 ms 5772 KB Output is correct
7 Incorrect 0 ms 5772 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5772 KB Output is correct
2 Correct 0 ms 5772 KB Output is correct
3 Correct 0 ms 5772 KB Output is correct
4 Correct 0 ms 5772 KB Output is correct
5 Correct 0 ms 5772 KB Output is correct
6 Correct 0 ms 5772 KB Output is correct
7 Correct 0 ms 5772 KB Output is correct
8 Correct 0 ms 5772 KB Output is correct
9 Correct 0 ms 5772 KB Output is correct
10 Correct 0 ms 5772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 48 ms 5772 KB Output is correct
2 Correct 0 ms 5772 KB Output is correct
3 Correct 40 ms 5772 KB Output is correct
4 Correct 20 ms 5772 KB Output is correct
5 Correct 34 ms 5772 KB Output is correct
6 Correct 32 ms 5772 KB Output is correct
7 Correct 32 ms 5772 KB Output is correct
8 Correct 30 ms 5772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 5772 KB Output is correct
2 Correct 43 ms 5772 KB Output is correct
3 Correct 19 ms 5772 KB Output is correct
4 Correct 33 ms 5772 KB Output is correct
5 Correct 40 ms 5772 KB Output is correct
6 Correct 27 ms 5772 KB Output is correct
7 Correct 33 ms 5772 KB Output is correct
8 Correct 39 ms 5772 KB Output is correct
9 Correct 25 ms 5772 KB Output is correct
10 Correct 45 ms 5772 KB Output is correct
11 Incorrect 35 ms 5772 KB Output isn't correct
12 Correct 33 ms 5772 KB Output is correct
13 Correct 44 ms 5772 KB Output is correct
14 Correct 39 ms 5772 KB Output is correct
15 Correct 27 ms 5772 KB Output is correct