# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
346559 |
2021-01-10T08:21:44 Z |
Pety |
Stove (JOI18_stove) |
C++14 |
|
67 ms |
2280 KB |
#include <bits/stdc++.h>
using namespace std;
int n, t, a[100002], ans;
int main()
{
cin >> n >> t;
vector<int>gap;
for (int i = 1; i <= n; i++) {
cin >> a[i];
if (i > 1)
gap.push_back(a[i] - a[i - 1] - 1);
}
ans = a[n];
sort(gap.begin(), gap.end(), greater<int>());
for (int i = 0; i < t - 1; i++)
ans -= gap[i];
cout << ans - a[1] + 1;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
364 KB |
Output is correct |
10 |
Correct |
2 ms |
364 KB |
Output is correct |
11 |
Correct |
2 ms |
364 KB |
Output is correct |
12 |
Correct |
2 ms |
492 KB |
Output is correct |
13 |
Correct |
2 ms |
364 KB |
Output is correct |
14 |
Correct |
2 ms |
364 KB |
Output is correct |
15 |
Correct |
2 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
364 KB |
Output is correct |
10 |
Correct |
2 ms |
364 KB |
Output is correct |
11 |
Correct |
2 ms |
364 KB |
Output is correct |
12 |
Correct |
2 ms |
492 KB |
Output is correct |
13 |
Correct |
2 ms |
364 KB |
Output is correct |
14 |
Correct |
2 ms |
364 KB |
Output is correct |
15 |
Correct |
2 ms |
364 KB |
Output is correct |
16 |
Correct |
50 ms |
2152 KB |
Output is correct |
17 |
Correct |
53 ms |
2280 KB |
Output is correct |
18 |
Correct |
50 ms |
2152 KB |
Output is correct |
19 |
Correct |
49 ms |
2152 KB |
Output is correct |
20 |
Correct |
50 ms |
2152 KB |
Output is correct |
21 |
Correct |
51 ms |
2152 KB |
Output is correct |
22 |
Correct |
67 ms |
2276 KB |
Output is correct |
23 |
Correct |
50 ms |
2152 KB |
Output is correct |
24 |
Correct |
52 ms |
2152 KB |
Output is correct |