# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1034836 |
2024-07-25T19:33:25 Z |
DeathIsAwe |
Stove (JOI18_stove) |
C++14 |
|
0 ms |
348 KB |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n,k; cin >> n >> k; k--;
vector<int> times(n),timediffs;
for (int i=0;i<n;i++) {
cin >> times[i];
}
sort(times.begin(),times.end());
for (int i=0;i<n-1;i++) {
timediffs.push_back(times[i+1]-times[i]);
}
int ans = times[n-1];
sort(timediffs.begin(),timediffs.end(),greater<int>());
for (int i=0;i<k;i++) {
ans -= (timediffs[i]-1);
}
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |