# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
200093 | 2020-02-05T10:19:50 Z | Saboon | Kisik (COCI19_kisik) | C++14 | 1585 ms | 65676 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1e6 + 10; const ll inf = 1e18; pair<int, int> a[maxn]; int main(){ ios_base::sync_with_stdio(false); int n, k; cin >> n >> k; for (int i = 0; i < n; i++) cin >> a[i].second >> a[i].first; sort(a, a + n); multiset<int> s; ll answer = inf; ll sum = 0; for (int i = 0; i < n; i++){ s.insert(a[i].second); sum += a[i].second; if (s.size() > k){ auto it = s.end(); it --; sum -= *it; s.erase(it); } if (s.size() == k) answer = min(answer, 1ll * sum * a[i].first); } cout << answer << endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 380 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 6 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 6 ms | 376 KB | Output is correct |
3 | Correct | 6 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 392 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 508 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 6 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 130 ms | 6664 KB | Output is correct |
2 | Correct | 715 ms | 28428 KB | Output is correct |
3 | Correct | 839 ms | 40944 KB | Output is correct |
4 | Correct | 740 ms | 37976 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 337 ms | 15720 KB | Output is correct |
2 | Correct | 56 ms | 5624 KB | Output is correct |
3 | Correct | 137 ms | 10580 KB | Output is correct |
4 | Correct | 597 ms | 33192 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 244 ms | 15228 KB | Output is correct |
2 | Correct | 238 ms | 12408 KB | Output is correct |
3 | Correct | 242 ms | 11940 KB | Output is correct |
4 | Correct | 1585 ms | 65676 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 298 ms | 15048 KB | Output is correct |
2 | Correct | 1176 ms | 42368 KB | Output is correct |
3 | Correct | 286 ms | 15212 KB | Output is correct |
4 | Correct | 1000 ms | 46408 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 478 ms | 19820 KB | Output is correct |
2 | Correct | 834 ms | 35768 KB | Output is correct |
3 | Correct | 581 ms | 25440 KB | Output is correct |
4 | Correct | 364 ms | 22044 KB | Output is correct |