# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
42089 | 2018-02-22T10:56:41 Z | nonocut | Stove (JOI18_stove) | C++14 | 33 ms | 3116 KB |
#include<bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; int n,k; int p[maxn]; int main() { int i,x,y; scanf("%d%d",&n,&k); for(i=0;i<n;i++) { scanf("%d",&x); if(i) p[i] = x-y-1; y = x; } sort(p,p+n); int ans = n; for(i=0;i<n-k+1;i++) ans += p[i]; printf("%d",ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 1 ms | 376 KB | Output is correct |
3 | Correct | 1 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 436 KB | Output is correct |
5 | Correct | 1 ms | 476 KB | Output is correct |
6 | Correct | 2 ms | 548 KB | Output is correct |
7 | Correct | 2 ms | 572 KB | Output is correct |
8 | Correct | 2 ms | 588 KB | Output is correct |
9 | Correct | 1 ms | 588 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 1 ms | 376 KB | Output is correct |
3 | Correct | 1 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 436 KB | Output is correct |
5 | Correct | 1 ms | 476 KB | Output is correct |
6 | Correct | 2 ms | 548 KB | Output is correct |
7 | Correct | 2 ms | 572 KB | Output is correct |
8 | Correct | 2 ms | 588 KB | Output is correct |
9 | Correct | 1 ms | 588 KB | Output is correct |
10 | Correct | 3 ms | 640 KB | Output is correct |
11 | Correct | 2 ms | 672 KB | Output is correct |
12 | Correct | 2 ms | 704 KB | Output is correct |
13 | Correct | 2 ms | 736 KB | Output is correct |
14 | Correct | 2 ms | 768 KB | Output is correct |
15 | Correct | 2 ms | 800 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 1 ms | 376 KB | Output is correct |
3 | Correct | 1 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 436 KB | Output is correct |
5 | Correct | 1 ms | 476 KB | Output is correct |
6 | Correct | 2 ms | 548 KB | Output is correct |
7 | Correct | 2 ms | 572 KB | Output is correct |
8 | Correct | 2 ms | 588 KB | Output is correct |
9 | Correct | 1 ms | 588 KB | Output is correct |
10 | Correct | 3 ms | 640 KB | Output is correct |
11 | Correct | 2 ms | 672 KB | Output is correct |
12 | Correct | 2 ms | 704 KB | Output is correct |
13 | Correct | 2 ms | 736 KB | Output is correct |
14 | Correct | 2 ms | 768 KB | Output is correct |
15 | Correct | 2 ms | 800 KB | Output is correct |
16 | Correct | 31 ms | 1856 KB | Output is correct |
17 | Correct | 26 ms | 2820 KB | Output is correct |
18 | Correct | 30 ms | 3016 KB | Output is correct |
19 | Correct | 30 ms | 3016 KB | Output is correct |
20 | Correct | 25 ms | 3116 KB | Output is correct |
21 | Correct | 28 ms | 3116 KB | Output is correct |
22 | Correct | 26 ms | 3116 KB | Output is correct |
23 | Correct | 25 ms | 3116 KB | Output is correct |
24 | Correct | 33 ms | 3116 KB | Output is correct |