제출 #1344947

#제출 시각아이디문제언어결과실행 시간메모리
1344947jumpStove (JOI18_stove)C++20
0 / 100
0 ms348 KiB
#include <bits/stdc++.h>
#define int long long


signed main(){
	int n,k;
	std::cin >> n >> k;
	int fuel = n;
	std::priority_queue<int> pq;
	int last;
	std::cin >> last;
	for(int i=1;i<n;i++){
		int in;
		std::cin >> in;
		pq.push(last-in+1);
	}
	while(n>k){
		//std::cout << pq.top() << ' ';
		fuel-=pq.top();pq.pop();
		n--;
	}
	std::cout << fuel;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...