# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
507243 | 2022-01-12T09:56:25 Z | amukkalir | Stove (JOI18_stove) | C++17 | 33 ms | 2140 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define pii pair<ll,ll> #define se second #define fi first #define pb push_back #define wek puts("wekwek") #define wik puts("-------") const int nax = 1e5; int n, k; int t[nax+5]; signed main () { scanf("%d %d", &n, &k); priority_queue<int,vector<int>,greater<int>> pq; int ans = n; for(int i=0; i<n; i++) { scanf("%d", &t[i]); if(i > 0) { pq.push(t[i]-t[i-1]-1); } } for(int i=0; i<n-k; i++) { ans += pq.top(); pq.pop(); } printf("%d", ans); } /* */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 304 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 0 ms | 300 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
8 | Correct | 0 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 304 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 0 ms | 300 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
8 | Correct | 0 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 332 KB | Output is correct |
11 | Correct | 1 ms | 332 KB | Output is correct |
12 | Correct | 2 ms | 344 KB | Output is correct |
13 | Correct | 1 ms | 344 KB | Output is correct |
14 | Correct | 2 ms | 308 KB | Output is correct |
15 | Correct | 1 ms | 332 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 304 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 0 ms | 300 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
8 | Correct | 0 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 332 KB | Output is correct |
11 | Correct | 1 ms | 332 KB | Output is correct |
12 | Correct | 2 ms | 344 KB | Output is correct |
13 | Correct | 1 ms | 344 KB | Output is correct |
14 | Correct | 2 ms | 308 KB | Output is correct |
15 | Correct | 1 ms | 332 KB | Output is correct |
16 | Correct | 25 ms | 2092 KB | Output is correct |
17 | Correct | 25 ms | 2088 KB | Output is correct |
18 | Correct | 33 ms | 2068 KB | Output is correct |
19 | Correct | 27 ms | 2056 KB | Output is correct |
20 | Correct | 27 ms | 2120 KB | Output is correct |
21 | Correct | 20 ms | 2064 KB | Output is correct |
22 | Correct | 22 ms | 2140 KB | Output is correct |
23 | Correct | 14 ms | 2128 KB | Output is correct |
24 | Correct | 14 ms | 2104 KB | Output is correct |