Submission #127208

# Submission time Handle Problem Language Result Execution time Memory
127208 2019-07-09T06:43:51 Z gaoxam123 Stove (JOI18_stove) C++14
0 / 100
2 ms 376 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];
			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 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -