# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
437241 | 2021-06-26T05:59:14 Z | ToroTN | Stove (JOI18_stove) | C++14 | 78 ms | 5612 KB |
#include<bits/stdc++.h> using namespace std; int n,m,a[100005],sum; multiset<int> s; int main() { scanf("%d%d",&n,&m); sum=n; for(int i=1;i<=n;i++) { scanf("%d",&a[i]); } for(int i=2;i<=n;i++) { s.insert(a[i]-a[i-1]-1); } for(int i=1;i<=n-m;i++) { sum+=*s.begin(); s.erase(s.find(*s.begin())); } printf("%d\n",sum); }
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 | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 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 | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 2 ms | 460 KB | Output is correct |
11 | Correct | 2 ms | 460 KB | Output is correct |
12 | Correct | 3 ms | 460 KB | Output is correct |
13 | Correct | 2 ms | 460 KB | Output is correct |
14 | Correct | 3 ms | 436 KB | Output is correct |
15 | Correct | 3 ms | 460 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 | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 2 ms | 460 KB | Output is correct |
11 | Correct | 2 ms | 460 KB | Output is correct |
12 | Correct | 3 ms | 460 KB | Output is correct |
13 | Correct | 2 ms | 460 KB | Output is correct |
14 | Correct | 3 ms | 436 KB | Output is correct |
15 | Correct | 3 ms | 460 KB | Output is correct |
16 | Correct | 77 ms | 5612 KB | Output is correct |
17 | Correct | 78 ms | 5532 KB | Output is correct |
18 | Correct | 65 ms | 5588 KB | Output is correct |
19 | Correct | 52 ms | 5536 KB | Output is correct |
20 | Correct | 54 ms | 5584 KB | Output is correct |
21 | Correct | 57 ms | 5584 KB | Output is correct |
22 | Correct | 46 ms | 5552 KB | Output is correct |
23 | Correct | 63 ms | 5572 KB | Output is correct |
24 | Correct | 62 ms | 5600 KB | Output is correct |