| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 503335 | rainboy | Akcija (COCI21_akcija) | C11 | 8 ms | 5364 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#define N 2000
int main() {
static int ww[N], qu[N][N], cnt[N];
static char available[N];
int n, k, h, i, d, c, c_;
long long w_;
scanf("%d%d", &n, &k);
for (i = 0; i < n; i++) {
scanf("%d%d", &ww[i], &d), d--;
qu[d][cnt[d]++] = i;
}
c_ = 0, w_ = 0;
for (d = n - 1, c = 0; d >= 0; d--) {
for (h = 0; h < cnt[d]; h++)
available[qu[d][h]] = 1, c++;
if (c > 0) {
int i_;
i_ = -1;
for (i = 0; i < n; i++)
if (available[i] && (i_ == -1 || ww[i_] > ww[i]))
i_ = i;
available[i_] = 0, c--;
c_++, w_ += ww[i_];
}
}
printf("%d %lld\n", c_, w_);
return 0;
}
컴파일 시 표준 에러 (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... | ||||
