Submission #218719

#TimeUsernameProblemLanguageResultExecution timeMemory
218719quocnguyen1012Kisik (COCI19_kisik)C++14
90 / 90
1225 ms65784 KiB
#include <bits/stdc++.h> #define fi first #define se second #define mp make_pair #define pb push_back #define eb emplace_back using namespace std; typedef long long ll; typedef pair<int, int> ii; const int maxn = 1e6 + 5; signed main(void) { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #ifdef LOCAL freopen("A.INP", "r", stdin); freopen("A.OUT", "w", stdout); #endif // LOCAL int n, k; cin >> n >> k; vector<ii> a(n); for(auto & it : a){ cin >> it.se >> it.fi; } sort(a.begin(), a.end()); ll res = 1e18, sum = 0; multiset<int> se; for(auto & it : a){ se.insert(it.se); sum += it.se; if(se.size() > k){ sum -= *se.rbegin(); se.erase(se.find(*se.rbegin())); } if(se.size() == k){ res = min(res, sum * it.fi); } } cout << res; }

Compilation message (stderr)

kisik.cpp: In function 'int main()':
kisik.cpp:33:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(se.size() > k){
                  ^
kisik.cpp:37:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(se.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...