# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1033835 | 2024-07-25T06:49:42 Z | vjudge1 | Stove (JOI18_stove) | C++11 | 38 ms | 3540 KB |
#include <bits/stdc++.h> const long long MAXN = 1e5 + 1; using namespace std; long long n, k, total_time = 0, skipped_time = 0; long long a[MAXN]; vector<long long> gaps; int main() { cin >> n >> k; for (int i = 0; i < n; i ++) { cin >> a[i]; } for (int i = 1; i < n; i ++) { gaps.push_back(a[i] - a[i - 1] - 1); } sort(gaps.begin(), gaps.end(), greater<long long>()); total_time = a[n - 1] - a[0] + 1; for (int i = 0; i < k - 1 && i < gaps.size(); i ++) { skipped_time += gaps[i]; } cout << total_time - skipped_time << "\n"; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 348 KB | Output is correct |
12 | Correct | 1 ms | 348 KB | Output is correct |
13 | Correct | 1 ms | 348 KB | Output is correct |
14 | Correct | 1 ms | 460 KB | Output is correct |
15 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 348 KB | Output is correct |
12 | Correct | 1 ms | 348 KB | Output is correct |
13 | Correct | 1 ms | 348 KB | Output is correct |
14 | Correct | 1 ms | 460 KB | Output is correct |
15 | Correct | 1 ms | 348 KB | Output is correct |
16 | Correct | 38 ms | 3540 KB | Output is correct |
17 | Correct | 30 ms | 3284 KB | Output is correct |
18 | Correct | 30 ms | 3260 KB | Output is correct |
19 | Correct | 34 ms | 3084 KB | Output is correct |
20 | Correct | 31 ms | 3276 KB | Output is correct |
21 | Correct | 29 ms | 3324 KB | Output is correct |
22 | Correct | 29 ms | 3252 KB | Output is correct |
23 | Correct | 37 ms | 3276 KB | Output is correct |
24 | Correct | 30 ms | 3284 KB | Output is correct |