# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
882147 | rainboy | Fun Palace (CCO18_fun) | C11 | 27 ms | 584 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <string.h>
#define C 20000
int max(int a, int b) { return a > b ? a : b; }
int main() {
static int dp[C + 1], dq[C + 1];
int n, a, b, c, c_, x, ans;
scanf("%d%d", &n, &b);
memset(dp, -1, (C + 1) * sizeof *dp);
for (c = 0; c < b; c++)
dp[c] = c;
while (--n) {
scanf("%d%d", &a, &b);
memset(dq, -1, (C + 1) * sizeof *dq);
x = -1;
for (c = 0; c < a; c++)
if (dp[c] != -1) {
x = max(x, dp[c]);
dq[c + b] = max(dq[c + b], dp[c] + b);
}
if (x != -1)
for (c = 0; c < b; c++)
dq[c] = max(dq[c], x + c);
for (c = a; c <= C; c++) {
c_ = c >= a + b ? c : c - a;
dq[c_] = max(dq[c_], dp[c]);
컴파일 시 표준 에러 (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... |