# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
678040 |
2023-01-05T05:08:38 Z |
vjudge1 |
Stove (JOI18_stove) |
C++17 |
|
1 ms |
596 KB |
#include <bits/stdc++.h>
using namespace std;
deque <int> d;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n , k, a[100005], ans=0;
cin >> n >> k;
if(k==1){
cout<<n;
return 0;
}
for(int i=1; i<=n; i++){
cin >> a[i];
}
ans=a[1]-1;
for(int i=2; i<n; i++){
d.push_back(a[i]-a[i-1]);
}
sort(d.begin(), d.end());
for(int i=0; i<k; i++){
ans+=d[i];
}
cout<<a[n] - ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
596 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
596 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
596 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |