Submission #914350

# Submission time Handle Problem Language Result Execution time Memory
914350 2024-01-21T17:22:02 Z LM1 Stove (JOI18_stove) C++14
0 / 100
1 ms 432 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();
	}
	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 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Incorrect 0 ms 432 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 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 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Incorrect 0 ms 432 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 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 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Incorrect 0 ms 432 KB Output isn't correct
10 Halted 0 ms 0 KB -