# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
711412 | 2023-03-16T21:10:58 Z | thimote75 | Stove (JOI18_stove) | C++14 | 49 ms | 2324 KB |
#include <bits/stdc++.h> using namespace std; #define num long long int main () { int nbNodes, nbVal; cin >> nbNodes >> nbVal; nbVal --; vector<num> deltas; int last = 0; for (int i = 0; i < nbNodes; i ++) { int curr; cin >> curr; if (last != 0) deltas.push_back(curr - last - 1); last = curr; } sort(deltas.rbegin(), deltas.rend()); num answer = 0; for (int i = nbVal; i < deltas.size(); i ++) answer += deltas[i]; cout << (answer + nbNodes); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 2 ms | 340 KB | Output is correct |
11 | Correct | 2 ms | 340 KB | Output is correct |
12 | Correct | 3 ms | 340 KB | Output is correct |
13 | Correct | 2 ms | 308 KB | Output is correct |
14 | Correct | 2 ms | 340 KB | Output is correct |
15 | Correct | 2 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 2 ms | 340 KB | Output is correct |
11 | Correct | 2 ms | 340 KB | Output is correct |
12 | Correct | 3 ms | 340 KB | Output is correct |
13 | Correct | 2 ms | 308 KB | Output is correct |
14 | Correct | 2 ms | 340 KB | Output is correct |
15 | Correct | 2 ms | 340 KB | Output is correct |
16 | Correct | 45 ms | 2248 KB | Output is correct |
17 | Correct | 45 ms | 2288 KB | Output is correct |
18 | Correct | 43 ms | 2216 KB | Output is correct |
19 | Correct | 44 ms | 2216 KB | Output is correct |
20 | Correct | 49 ms | 2252 KB | Output is correct |
21 | Correct | 44 ms | 2324 KB | Output is correct |
22 | Correct | 45 ms | 2300 KB | Output is correct |
23 | Correct | 45 ms | 2316 KB | Output is correct |
24 | Correct | 44 ms | 2200 KB | Output is correct |