# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
590983 |
2022-07-06T16:48:17 Z |
piOOE |
Stove (JOI18_stove) |
C++17 |
|
1 ms |
212 KB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, k;
cin >> n >> k;
vector<int> t(n);
for (int i = 0; i < n; ++i)
cin >> t[i];
vector<int> v(n - 1);
for (int i = 0; i < n; ++i)
v[i] = t[i + 1] - t[i];
sort(v.begin(), v.end());
int ans = t[n - 1] - t[0] + 1;
for (int i = n - 2; i >= k; --i) {
ans -= v[i] - 1;
}
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |