Submission #100528

#TimeUsernameProblemLanguageResultExecution timeMemory
100528FeederKisik (COCI19_kisik)C++11
0 / 90
90 ms9312 KiB
#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)

kisik.cpp: In function 'int main()':
kisik.cpp:7:12: warning: 'mn' may be used uninitialized in this function [-Wmaybe-uninitialized]
  long long mn, curw = 0;
            ^~
#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...