Submission #914351

# Submission time Handle Problem Language Result Execution time Memory
914351 2024-01-21T17:25:28 Z LM1 Stove (JOI18_stove) C++14
100 / 100
39 ms 2512 KB
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e5+5;
int n,k,ans,t,t1;
priority_queue<int>v;
main(){
	cin>>n>>k;
	cin>>t1;
	ans=t1;
	for(int i=0;i<n-1;i++){
		cin>>t;
		v.push(t-t1-1);
		t1=t;
	}
	ans=t-ans+1;
	k--;while(k--){
		ans-=v.top();
		v.pop();
	}
	if(n==1){cout<<1;return 0;}
	cout<<ans;
}

Compilation message

stove.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main(){
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 504 KB Output is correct
10 Correct 2 ms 344 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 504 KB Output is correct
10 Correct 2 ms 344 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 30 ms 2256 KB Output is correct
17 Correct 30 ms 2252 KB Output is correct
18 Correct 29 ms 2260 KB Output is correct
19 Correct 30 ms 2360 KB Output is correct
20 Correct 35 ms 2248 KB Output is correct
21 Correct 38 ms 2256 KB Output is correct
22 Correct 39 ms 2248 KB Output is correct
23 Correct 39 ms 2260 KB Output is correct
24 Correct 38 ms 2512 KB Output is correct