# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
365851 |
2021-02-12T12:55:38 Z |
l3nl3 |
Stove (JOI18_stove) |
C++17 |
|
1 ms |
364 KB |
#include <bits/stdc++.h>
using namespace std;
int main () {
int n, k;
cin >> n >> k;
int t[n+1];
for (int i = 1; i <= n; i++) {
cin >> t[i];
}
int mx = t[n] - t[1] + 1;
vector<int> dif;
for (int i = 1; i < n; i++) {
dif.push_back(t[i+1] - t[i] - 1);
}
sort(dif.begin(), dif.end());
for (int i = 0; i < min((int)dif.size(), k); i++) {
mx -= dif[i];
}
cout << mx;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
0 ms |
364 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
0 ms |
364 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
0 ms |
364 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |