# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
120403 | FutymyClone | Kisik (COCI19_kisik) | C++14 | 1620 ms | 65600 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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();
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |