Submission #48910

# Submission time Handle Problem Language Result Execution time Memory
48910 2018-05-19T17:28:34 Z faustaadp Stove (JOI18_stove) C++17
100 / 100
43 ms 10288 KB
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll n,k,i,a[101010],has;
vector<ll> v;
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n>>k;
	for(i=1;i<=n;i++)
		cin>>a[i];
	for(i=1;i<n;i++)
		v.pb(a[i+1]-a[i]-1);
	sort(v.begin(),v.end());
	for(i=0;i<n-k;i++)
		has+=v[i];
	has+=n;
	cout<<has<<"\n";
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 2 ms 436 KB Output is correct
4 Correct 2 ms 516 KB Output is correct
5 Correct 3 ms 520 KB Output is correct
6 Correct 2 ms 524 KB Output is correct
7 Correct 2 ms 568 KB Output is correct
8 Correct 2 ms 648 KB Output is correct
9 Correct 2 ms 664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 2 ms 436 KB Output is correct
4 Correct 2 ms 516 KB Output is correct
5 Correct 3 ms 520 KB Output is correct
6 Correct 2 ms 524 KB Output is correct
7 Correct 2 ms 568 KB Output is correct
8 Correct 2 ms 648 KB Output is correct
9 Correct 2 ms 664 KB Output is correct
10 Correct 10 ms 792 KB Output is correct
11 Correct 4 ms 820 KB Output is correct
12 Correct 4 ms 856 KB Output is correct
13 Correct 3 ms 1016 KB Output is correct
14 Correct 3 ms 1016 KB Output is correct
15 Correct 3 ms 1016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 2 ms 436 KB Output is correct
4 Correct 2 ms 516 KB Output is correct
5 Correct 3 ms 520 KB Output is correct
6 Correct 2 ms 524 KB Output is correct
7 Correct 2 ms 568 KB Output is correct
8 Correct 2 ms 648 KB Output is correct
9 Correct 2 ms 664 KB Output is correct
10 Correct 10 ms 792 KB Output is correct
11 Correct 4 ms 820 KB Output is correct
12 Correct 4 ms 856 KB Output is correct
13 Correct 3 ms 1016 KB Output is correct
14 Correct 3 ms 1016 KB Output is correct
15 Correct 3 ms 1016 KB Output is correct
16 Correct 29 ms 3668 KB Output is correct
17 Correct 26 ms 4652 KB Output is correct
18 Correct 30 ms 5592 KB Output is correct
19 Correct 30 ms 6676 KB Output is correct
20 Correct 43 ms 7520 KB Output is correct
21 Correct 28 ms 8492 KB Output is correct
22 Correct 28 ms 9452 KB Output is correct
23 Correct 28 ms 10288 KB Output is correct
24 Correct 28 ms 10288 KB Output is correct