# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
100976 | KLPP | Kisik (COCI19_kisik) | C++14 | 501 ms | 32360 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;
typedef long long int lld;
int main(){
int n,k;
scanf("%d %d",&n,&k);
pair<lld,lld> arr[n];
for(int i=0;i<n;i++){
scanf("%lld %lld",&arr[i].second,&arr[i].first);
}
sort(arr,arr+n);
priority_queue<int> pq;
lld sum=0;
lld ans=1000000000000000000;
for(int i=0;i<n;i++){
pq.push(arr[i].second);
sum+=arr[i].second;
if(pq.size()>k){
sum-=pq.top();
pq.pop();
}
if(pq.size()==k){
ans=min(ans,sum*arr[i].first);
}
}cout<<ans<<endl;
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... |