# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
590130 | rainboy | Uplifting Excursion (BOI22_vault) | C11 | 2860 ms | 2256 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <string.h>
#define N 50
#define S 125000
int max(int a, int b) { return a > b ? a : b; }
int main() {
static int aa[N * 2 + 1], dp[S * 2 + 1];
int n, i, s;
long long s_;
scanf("%d%lld", &n, &s_);
for (i = -n; i <= n; i++)
scanf("%d", &aa[i + n]);
if (s_ < -S || s_ > S) {
printf("impossible\n");
return 0;
}
memset(dp, -1, (S * 2 + 1) * sizeof *dp), dp[S + 0] = 0;
for (i = -n; i <= n; i++)
while (aa[i + n]--) {
if (i < 0) {
for (s = -S; s <= S; s++)
if (dp[S + s] != -1)
dp[S + s + i] = max(dp[S + s + i], dp[S + s] + 1);
} else {
for (s = S; s >= -S; s--)
if (dp[S + s] != -1)
dp[S + s + i] = max(dp[S + s + i], dp[S + s] + 1);
}
}
if (dp[S + s_] == -1)
printf("impossible\n");
else
printf("%d\n", dp[S + s_]);
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... |
# | 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... |