# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
218719 | 2020-04-02T15:03:25 Z | quocnguyen1012 | Kisik (COCI19_kisik) | C++14 | 1225 ms | 65784 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 4 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 4 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 118 ms | 6648 KB | Output is correct |
2 | Correct | 585 ms | 28412 KB | Output is correct |
3 | Correct | 701 ms | 41080 KB | Output is correct |
4 | Correct | 626 ms | 38136 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 298 ms | 15736 KB | Output is correct |
2 | Correct | 53 ms | 5624 KB | Output is correct |
3 | Correct | 123 ms | 10492 KB | Output is correct |
4 | Correct | 508 ms | 33272 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 224 ms | 15096 KB | Output is correct |
2 | Correct | 235 ms | 12408 KB | Output is correct |
3 | Correct | 207 ms | 11896 KB | Output is correct |
4 | Correct | 1225 ms | 65784 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 245 ms | 15096 KB | Output is correct |
2 | Correct | 978 ms | 42488 KB | Output is correct |
3 | Correct | 218 ms | 15096 KB | Output is correct |
4 | Correct | 819 ms | 46456 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 390 ms | 20088 KB | Output is correct |
2 | Correct | 665 ms | 35832 KB | Output is correct |
3 | Correct | 475 ms | 25336 KB | Output is correct |
4 | Correct | 310 ms | 22136 KB | Output is correct |