Submission #123224

#TimeUsernameProblemLanguageResultExecution timeMemory
123224cveleKisik (COCI19_kisik)C++14
0 / 90
9 ms5308 KiB
#include <iostream> #include <sstream> #include <cstdio> #include <cstdlib> #include <cmath> #include <cctype> #include <cstring> #include <climits> #include <iomanip> #include <bitset> #include <algorithm> #include <vector> #include <stack> #include <queue> #include <deque> #include <set> #include <list> #include <map> using namespace std; const int N = 100005; int n, k; vector <int> mat[N]; multiset <int> ms; int main() { cin >> n >> k; for (int i = 0; i < n; i++) { int w, h; cin >> w >> h; mat[h].push_back(w); } long long ans = 2e18, sum = 0; for (int i = 1; i < N; i++) { for (auto it : mat[i]) { ms.insert(it); sum += it; } while (ms.size() > k) { sum -= *ms.rbegin(); ms.erase(--ms.end()); } if (ms.size() == k) { ans = min(ans, sum * i); } } cout << ans << endl; return 0; }

Compilation message (stderr)

kisik.cpp: In function 'int main()':
kisik.cpp:41:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while (ms.size() > k) {
            ~~~~~~~~~~^~~
kisik.cpp:45:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (ms.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...