# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
123236 | 2019-06-30T14:13:58 Z | cvele | Kisik (COCI19_kisik) | C++14 | 2000 ms | 53000 KB |
#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 = 1000005; int n, k; vector < pair <int, int> > vec; multiset <int> ms; int main() { cin >> n >> k; for (int i = 0; i < n; i++) { int w, h; cin >> w >> h; vec.push_back({h, w}); } sort(vec.begin(), vec.end()); int pos = 0; long long ans = 2e18, sum = 0; for (int i = 1; i < N; i++) { while (pos < n && vec[pos].first <= i) { sum += vec[pos].second; ms.insert(vec[pos].second); while (ms.size() > k) { sum -= *ms.rbegin(); ms.erase(--ms.end()); } pos++; } if (ms.size() == k) { ans = min(ans, 1ll * sum * i); } } cout << ans << endl; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 256 KB | Output is correct |
2 | Correct | 6 ms | 376 KB | Output is correct |
3 | Correct | 7 ms | 376 KB | Output is correct |
4 | Correct | 7 ms | 504 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 376 KB | Output is correct |
2 | Correct | 7 ms | 376 KB | Output is correct |
3 | Correct | 7 ms | 376 KB | Output is correct |
4 | Correct | 6 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 252 KB | Output is correct |
2 | Correct | 6 ms | 376 KB | Output is correct |
3 | Correct | 7 ms | 376 KB | Output is correct |
4 | Correct | 6 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 296 KB | Output is correct |
2 | Correct | 7 ms | 376 KB | Output is correct |
3 | Correct | 6 ms | 400 KB | Output is correct |
4 | Correct | 7 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 382 ms | 4616 KB | Output is correct |
2 | Correct | 1218 ms | 20312 KB | Output is correct |
3 | Correct | 1281 ms | 32848 KB | Output is correct |
4 | Correct | 1166 ms | 30688 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 701 ms | 10012 KB | Output is correct |
2 | Correct | 132 ms | 4588 KB | Output is correct |
3 | Correct | 296 ms | 8496 KB | Output is correct |
4 | Correct | 999 ms | 26720 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 435 ms | 11748 KB | Output is correct |
2 | Correct | 716 ms | 8844 KB | Output is correct |
3 | Correct | 559 ms | 7004 KB | Output is correct |
4 | Execution timed out | 2068 ms | 53000 KB | Time limit exceeded |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 545 ms | 10924 KB | Output is correct |
2 | Correct | 1789 ms | 30564 KB | Output is correct |
3 | Correct | 477 ms | 11484 KB | Output is correct |
4 | Correct | 1449 ms | 37524 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1004 ms | 10948 KB | Output is correct |
2 | Correct | 1240 ms | 27592 KB | Output is correct |
3 | Correct | 916 ms | 19136 KB | Output is correct |
4 | Correct | 611 ms | 17728 KB | Output is correct |