Submission #96698

#TimeUsernameProblemLanguageResultExecution timeMemory
96698nandonathanielKisik (COCI19_kisik)C++14
90 / 90
699 ms54604 KiB
#include<bits/stdc++.h> using namespace std; typedef long long LL; const LL MAXN=1000000; vector<LL> rec[MAXN+5]; priority_queue<LL> PQ; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); LL n,k,h,w; cin >> n >> k; for(LL i=1;i<=n;i++){ cin >> w >> h; rec[h].push_back(w); } LL res=0; LL ans=2e18; for(LL i=1;i<=MAXN;i++){ for(LL j=0;j<rec[i].size();j++){ res+=rec[i][j]; PQ.push(rec[i][j]); if(PQ.size()==k){ ans=min(ans,res*i); LL gede=PQ.top(); PQ.pop(); res-=gede; } } } cout << ans << endl; return 0; }

Compilation message (stderr)

kisik.cpp: In function 'int main()':
kisik.cpp:22:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(LL j=0;j<rec[i].size();j++){
              ~^~~~~~~~~~~~~~
kisik.cpp:25:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if(PQ.size()==k){
       ~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...