Submission #14046

# Submission time Handle Problem Language Result Execution time Memory
14046 2015-04-26T01:05:10 Z paulsohn 정전 (OJUZ10_blackout) C++
100 / 100
51 ms 1708 KB
#include <cstdio>
#include <algorithm>
using namespace std;

int N, X[160000];
long long L, a=-0xFFFFFFFF, b=-0xFFFFFFFFF, sum=0;

int main()
{
    int i,inp;
    scanf("%d%lld",&N,&L);
    for(i=0;i<N;++i) scanf("%d",X+i);
    sort(X,X+N);
    for(i=0;i<N;++i){
        if(b<X[i]-L){
            a=X[i]-L;
            b=X[i]+L;
        }
        else{
            sum+=b-max(a,X[i]-L);
            a=b;
            b=X[i]+L;
        }
    }
    printf("%lld",sum);

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1708 KB Output is correct
2 Correct 0 ms 1708 KB Output is correct
3 Correct 0 ms 1708 KB Output is correct
4 Correct 0 ms 1708 KB Output is correct
5 Correct 0 ms 1708 KB Output is correct
6 Correct 0 ms 1708 KB Output is correct
7 Correct 0 ms 1708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1708 KB Output is correct
2 Correct 0 ms 1708 KB Output is correct
3 Correct 0 ms 1708 KB Output is correct
4 Correct 0 ms 1708 KB Output is correct
5 Correct 0 ms 1708 KB Output is correct
6 Correct 0 ms 1708 KB Output is correct
7 Correct 0 ms 1708 KB Output is correct
8 Correct 0 ms 1708 KB Output is correct
9 Correct 1 ms 1708 KB Output is correct
10 Correct 0 ms 1708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 41 ms 1708 KB Output is correct
2 Correct 32 ms 1708 KB Output is correct
3 Correct 30 ms 1708 KB Output is correct
4 Correct 12 ms 1708 KB Output is correct
5 Correct 35 ms 1708 KB Output is correct
6 Correct 31 ms 1708 KB Output is correct
7 Correct 0 ms 1708 KB Output is correct
8 Correct 32 ms 1708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 1708 KB Output is correct
2 Correct 43 ms 1708 KB Output is correct
3 Correct 19 ms 1708 KB Output is correct
4 Correct 20 ms 1708 KB Output is correct
5 Correct 51 ms 1708 KB Output is correct
6 Correct 44 ms 1708 KB Output is correct
7 Correct 34 ms 1708 KB Output is correct
8 Correct 26 ms 1708 KB Output is correct
9 Correct 38 ms 1708 KB Output is correct
10 Correct 34 ms 1708 KB Output is correct
11 Correct 50 ms 1708 KB Output is correct
12 Correct 3 ms 1708 KB Output is correct
13 Correct 43 ms 1708 KB Output is correct
14 Correct 23 ms 1708 KB Output is correct
15 Correct 49 ms 1708 KB Output is correct