Submission #928507

# Submission time Handle Problem Language Result Execution time Memory
928507 2024-02-16T13:53:52 Z ting39 Stove (JOI18_stove) C++17
0 / 100
0 ms 348 KB
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
	int n,k;
	cin>>n>>k;
	vector<int> v(n-1);
	int ans=n,pre;
	cin>>pre;
	for(int i=0;i<n-1;i++){
		int a;
		cin>>a;
		v[i]=a-pre-1;
		pre=a;
	}
	sort(v.begin(),v.end());
	for(int i=0;i<k;i++) ans+=v[i];
	cout<<ans<<endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -