# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
64054 | 2018-08-03T09:03:07 Z | patrikpavic2 | Stove (JOI18_stove) | C++17 | 184 ms | 14460 KB |
#include <cstdio> #include <cstring> #include <set> #define X first using namespace std; typedef pair < int, int> pii; set < pii > s; int lst = 0, n, k, fir = 0, sol = 0; int main(){ scanf("%d%d", &n, &k); for(int i = 0;i<n;i++){ int x;scanf("%d", &x); if(lst) s.insert({x - lst - 1, i}); else fir = x; lst = x; } sol = lst - fir + 1; for(int i = 1;i<k;i++){ sol -= s.rbegin()->X; s.erase(*s.rbegin()); } printf("%d\n", sol); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 4 ms | 496 KB | Output is correct |
3 | Correct | 3 ms | 496 KB | Output is correct |
4 | Correct | 2 ms | 496 KB | Output is correct |
5 | Correct | 3 ms | 536 KB | Output is correct |
6 | Correct | 3 ms | 536 KB | Output is correct |
7 | Correct | 3 ms | 700 KB | Output is correct |
8 | Correct | 3 ms | 700 KB | Output is correct |
9 | Correct | 3 ms | 708 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 4 ms | 496 KB | Output is correct |
3 | Correct | 3 ms | 496 KB | Output is correct |
4 | Correct | 2 ms | 496 KB | Output is correct |
5 | Correct | 3 ms | 536 KB | Output is correct |
6 | Correct | 3 ms | 536 KB | Output is correct |
7 | Correct | 3 ms | 700 KB | Output is correct |
8 | Correct | 3 ms | 700 KB | Output is correct |
9 | Correct | 3 ms | 708 KB | Output is correct |
10 | Correct | 5 ms | 880 KB | Output is correct |
11 | Correct | 5 ms | 912 KB | Output is correct |
12 | Correct | 6 ms | 960 KB | Output is correct |
13 | Correct | 5 ms | 1008 KB | Output is correct |
14 | Correct | 7 ms | 1040 KB | Output is correct |
15 | Correct | 6 ms | 1072 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 4 ms | 496 KB | Output is correct |
3 | Correct | 3 ms | 496 KB | Output is correct |
4 | Correct | 2 ms | 496 KB | Output is correct |
5 | Correct | 3 ms | 536 KB | Output is correct |
6 | Correct | 3 ms | 536 KB | Output is correct |
7 | Correct | 3 ms | 700 KB | Output is correct |
8 | Correct | 3 ms | 700 KB | Output is correct |
9 | Correct | 3 ms | 708 KB | Output is correct |
10 | Correct | 5 ms | 880 KB | Output is correct |
11 | Correct | 5 ms | 912 KB | Output is correct |
12 | Correct | 6 ms | 960 KB | Output is correct |
13 | Correct | 5 ms | 1008 KB | Output is correct |
14 | Correct | 7 ms | 1040 KB | Output is correct |
15 | Correct | 6 ms | 1072 KB | Output is correct |
16 | Correct | 153 ms | 6608 KB | Output is correct |
17 | Correct | 154 ms | 7532 KB | Output is correct |
18 | Correct | 147 ms | 8552 KB | Output is correct |
19 | Correct | 134 ms | 9516 KB | Output is correct |
20 | Correct | 174 ms | 10548 KB | Output is correct |
21 | Correct | 166 ms | 11364 KB | Output is correct |
22 | Correct | 170 ms | 12296 KB | Output is correct |
23 | Correct | 184 ms | 13516 KB | Output is correct |
24 | Correct | 163 ms | 14460 KB | Output is correct |