Submission #127210

# Submission time Handle Problem Language Result Execution time Memory
127210 2019-07-09T06:45:01 Z gaoxam123 Stove (JOI18_stove) C++14
0 / 100
2 ms 256 KB
#include<bits/stdc++.h>
using namespace std;
int n,k;
int a[100005];
vector<int> ans;
int main(){
	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 -