# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
127214 |
2019-07-09T06:46:21 Z |
gaoxam123 |
Stove (JOI18_stove) |
C++14 |
|
2 ms |
256 KB |
#include<bits/stdc++.h>
using namespace std;
int n,k;
int a[100005];
int main(){
vector<int> ans;
cin>>n>>k;
for(int i=1;i<=n;i++){
cin>>a[i];
}
for(int i=2;i<=n;i++){
ans.push_back(a[i]-a[i-1]);
}
sort(ans.begin(),ans.end());
int cnt=k;
for(int i=1;i<=n-k;i++){
cnt+=ans[i];
}
cout<<cnt;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |