Submission #14185

# Submission time Handle Problem Language Result Execution time Memory
14185 2015-05-03T09:37:27 Z ainu7 정전 (OJUZ10_blackout) C++
100 / 100
103 ms 2892 KB
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <sstream>
#include <set>
using namespace std;

int main()
{
  long long N, L;
  cin >> N >> L;
  L *= 2;

  vector<long long> V(N);
  for (int i=0; i<N; i++) {
    cin >> V[i];
  }

  sort(V.begin(), V.end());

  long long p1 = -999999999;
  long long p2 = -999999999;
  long long res = 0;

  for (int i=0; i<N; i++) {
    res += max(0LL, p2 - max(p1, V[i]));

    p1 = max(p2, V[i]);
    p2 = V[i] + L;
  }

  cout << res << endl;
} 
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1720 KB Output is correct
2 Correct 0 ms 1720 KB Output is correct
3 Correct 0 ms 1720 KB Output is correct
4 Correct 0 ms 1720 KB Output is correct
5 Correct 0 ms 1720 KB Output is correct
6 Correct 0 ms 1720 KB Output is correct
7 Correct 0 ms 1720 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1720 KB Output is correct
2 Correct 0 ms 1720 KB Output is correct
3 Correct 0 ms 1720 KB Output is correct
4 Correct 0 ms 1720 KB Output is correct
5 Correct 0 ms 1720 KB Output is correct
6 Correct 0 ms 1720 KB Output is correct
7 Correct 0 ms 1720 KB Output is correct
8 Correct 0 ms 1720 KB Output is correct
9 Correct 0 ms 1720 KB Output is correct
10 Correct 1 ms 1720 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 58 ms 2504 KB Output is correct
2 Correct 78 ms 2892 KB Output is correct
3 Correct 49 ms 2456 KB Output is correct
4 Correct 21 ms 2192 KB Output is correct
5 Correct 4 ms 1720 KB Output is correct
6 Correct 99 ms 2892 KB Output is correct
7 Correct 94 ms 2892 KB Output is correct
8 Correct 65 ms 2504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 95 ms 2892 KB Output is correct
2 Correct 65 ms 2504 KB Output is correct
3 Correct 39 ms 2328 KB Output is correct
4 Correct 76 ms 2892 KB Output is correct
5 Correct 4 ms 1720 KB Output is correct
6 Correct 50 ms 2456 KB Output is correct
7 Correct 93 ms 2892 KB Output is correct
8 Correct 91 ms 2892 KB Output is correct
9 Correct 90 ms 2892 KB Output is correct
10 Correct 99 ms 2892 KB Output is correct
11 Correct 67 ms 2504 KB Output is correct
12 Correct 103 ms 2892 KB Output is correct
13 Correct 43 ms 2192 KB Output is correct
14 Correct 51 ms 2488 KB Output is correct
15 Correct 62 ms 2504 KB Output is correct