# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
207068 |
2020-03-06T10:00:44 Z |
Blerargh |
Stove (JOI18_stove) |
C++17 |
|
5 ms |
504 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ll n, k, x, prev, sum=0;
cin >> n >> k >> prev;
vector<int> v;
for (int i=1; i<n; i++){
cin >> x;
sum += x-prev;
v.push_back(x-prev);
prev=x;
}
sort(v.begin(), v.end(), greater<int>());
for (int i=0; i<k-1; i++){
sum-=v[i];
sum++;
}
cout << sum;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
504 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
504 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
504 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |