# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
120403 | 2019-06-24T11:30:11 Z | FutymyClone | Kisik (COCI19_kisik) | C++14 | 1620 ms | 65600 KB |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5; multiset <int> widths; int n, k; struct Item { int w, h; bool operator < (const Item &rhs) const { if (h != rhs.h) return h < rhs.h; return w < rhs.w; } } a[N]; int main(){ scanf("%d %d", &n, &k); for (int i = 1; i <= n; i++) scanf("%d %d", &a[i].w, &a[i].h); sort(a + 1, a + n + 1); long long ans = 9e18; int ptr = 1; long long sum = 0; for (int i = 1; i <= n; i = ptr) { while (ptr <= n && a[ptr].h == a[i].h) widths.insert(a[ptr].w), sum += a[ptr].w, ptr++; if (widths.size() >= k) { while (widths.size() > k) { int val = *widths.rbegin(); sum -= val; widths.erase(widths.find(val)); } ans = min(ans, 1LL * sum * a[i].h); } } printf("%lld", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 3 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 3 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 122 ms | 6664 KB | Output is correct |
2 | Correct | 820 ms | 28292 KB | Output is correct |
3 | Correct | 950 ms | 40960 KB | Output is correct |
4 | Correct | 732 ms | 38120 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 402 ms | 15776 KB | Output is correct |
2 | Correct | 57 ms | 5624 KB | Output is correct |
3 | Correct | 130 ms | 10488 KB | Output is correct |
4 | Correct | 623 ms | 33172 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 259 ms | 15176 KB | Output is correct |
2 | Correct | 225 ms | 12508 KB | Output is correct |
3 | Correct | 235 ms | 12024 KB | Output is correct |
4 | Correct | 1620 ms | 65600 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 283 ms | 15120 KB | Output is correct |
2 | Correct | 1306 ms | 42388 KB | Output is correct |
3 | Correct | 283 ms | 15140 KB | Output is correct |
4 | Correct | 884 ms | 46512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 477 ms | 19788 KB | Output is correct |
2 | Correct | 790 ms | 35992 KB | Output is correct |
3 | Correct | 611 ms | 25464 KB | Output is correct |
4 | Correct | 405 ms | 22224 KB | Output is correct |