# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
100528 | Feeder | Kisik (COCI19_kisik) | C++11 | 90 ms | 9312 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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, curw = 0;
vector<pair<int, int> > vec;
cin >> n >> k;
for(int i=0; i<k; 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;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |