Submission #1106048

# Submission time Handle Problem Language Result Execution time Memory
1106048 2024-10-29T04:04:29 Z lufychop Stove (JOI18_stove) C++14
0 / 100
1 ms 336 KB
#include <bits/stdc++.h>

using namespace std;

int main(void)
{
	int n,k,ans=0;
	cin>>n>>k;
	int t[n],a[n];
	for(int i=0;i<n;i++)
	{
		cin>>t[i];
	}
	a[0]=1;
	for(int i=1;i<n;i++)
	{
		a[i]=t[i]-t[i-1]+1;
	}
	sort(a,a+n);
	for(int i=0;i<n-k;i++)
	{
		ans=ans+a[i];
	}
	cout<<ans+n;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -