# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
471271 | almothana05 | Kisik (COCI19_kisik) | C++14 | 365 ms | 43920 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>
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<unordered_map>
#include<set>
#include<cassert>
#include<vector>
using namespace std;
vector<pair<long long , long long > >num , pref;
priority_queue<long long>q;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// freopen("herding.in", "r", stdin);
// freopen("herding.out", "w", stdout);
long long menge ,numm , nummer , t , gew , rechner = 0 , erg = 0;
cin >> menge >> gew;
for(int i = 0 ; i < menge; i++){
cin >> numm >> nummer;
num.push_back(make_pair(nummer , numm));
}
sort(num.begin() , num.end());
for(int i = 0 ; i < gew ; i++){
q.push(num[i].second);
rechner += num[i].second;
}
erg = rechner * num[gew - 1].first;
for(int i = gew ; i < menge ; i++){
rechner -= q.top();
q.pop();
rechner += num[i].second;
q.push(num[i].second);
erg = min(erg , rechner * num[i].first);
}
cout << erg;
return 0;
}
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... |