Submission #202237

# Submission time Handle Problem Language Result Execution time Memory
202237 2020-02-14T11:23:03 Z AlexPop28 Stove (JOI18_stove) C++11
100 / 100
29 ms 1656 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);

  int n, k; cin >> n >> k;
  vector<int> v(n - 1);
  int lst; cin >> lst;
  for (int i = 0; i < n - 1; ++i) {
    int x; cin >> x;
    v[i] = x - lst - 1;
    lst = x;
  }
  sort(v.begin(), v.end());

  int ans = n;
  for (int i = 0; i < n - k; ++i) {
    ans += v[i];
  }
  cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 504 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 504 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 6 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 6 ms 504 KB Output is correct
14 Correct 7 ms 376 KB Output is correct
15 Correct 7 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 504 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 6 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 6 ms 504 KB Output is correct
14 Correct 7 ms 376 KB Output is correct
15 Correct 7 ms 376 KB Output is correct
16 Correct 28 ms 1656 KB Output is correct
17 Correct 29 ms 1656 KB Output is correct
18 Correct 28 ms 1656 KB Output is correct
19 Correct 29 ms 1656 KB Output is correct
20 Correct 28 ms 1656 KB Output is correct
21 Correct 29 ms 1656 KB Output is correct
22 Correct 28 ms 1656 KB Output is correct
23 Correct 29 ms 1656 KB Output is correct
24 Correct 28 ms 1656 KB Output is correct