답안 #100529

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
100529 2019-03-12T04:16:50 Z Feeder Kisik (COCI19_kisik) C++11
90 / 90
365 ms 28628 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, k, w, h;
	long long mn = 1e18, curw = 0;
	vector<pair<int, int> > vec;
	cin >> n >> k;
	for(int i=0; i<n; i++){
		cin >> w >> h;
		vec.push_back(make_pair(h, w));
	}
	priority_queue<int> pq;
	sort(vec.begin(), vec.end());
	for(int i=0; i<k; i++){
		curw += vec[i].second;
		pq.push(vec[i].second);
	}
	mn = min(mn, curw * vec[k-1].first);
	for(int i=k; i<n; i++){
		if(vec[i].second >= pq.top()) continue;
		curw -= pq.top();
		pq.pop();
		curw += vec[i].second;
		pq.push(vec[i].second);
		mn = min(mn, curw * vec[i].first);
	}
	cout << mn;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 88 ms 8172 KB Output is correct
2 Correct 237 ms 17048 KB Output is correct
3 Correct 223 ms 19632 KB Output is correct
4 Correct 187 ms 18520 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 155 ms 9068 KB Output is correct
2 Correct 25 ms 2800 KB Output is correct
3 Correct 51 ms 5224 KB Output is correct
4 Correct 147 ms 14492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 87 ms 4456 KB Output is correct
2 Correct 209 ms 15968 KB Output is correct
3 Correct 137 ms 9312 KB Output is correct
4 Correct 365 ms 28628 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 111 ms 6056 KB Output is correct
2 Correct 320 ms 23268 KB Output is correct
3 Correct 92 ms 8296 KB Output is correct
4 Correct 225 ms 21592 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 245 ms 14208 KB Output is correct
2 Correct 235 ms 17280 KB Output is correct
3 Correct 196 ms 13796 KB Output is correct
4 Correct 116 ms 10396 KB Output is correct