# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
577815 | 2022-06-15T09:30:26 Z | kingfran1907 | Uplifting Excursion (BOI22_vault) | C++14 | 1450 ms | 145356 KB |
#include <bits/stdc++.h> #define X first #define Y second using namespace std; typedef long long llint; const int maxn = 210; const int buf = maxn * maxn; const int inf = 0x3f3f3f3f; int n; llint l; int niz[2 * maxn]; int dp[2 * maxn][2 * maxn * maxn]; int f(int x, int val) { if (x == n + 1) { if (val == l) return 0; else return -inf; } int &ret = dp[x + maxn][val + buf]; if (ret != -1) return ret; ret = -inf; for (int i = 0; i <= niz[x + n]; i++) { ret = max(ret, i + f(x + 1, val + i * x)); } return ret; } int main() { scanf("%d%lld\n", &n, &l); for (int i = 0; i < n + n + 1; i++) scanf("%d", niz+i); memset(dp, -1, sizeof dp); int out = f(-n, 0); if (out < 0) printf("impossible\n"); else printf("%d\n", out); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 53 ms | 145228 KB | Output is correct |
2 | Correct | 56 ms | 145208 KB | Output is correct |
3 | Correct | 58 ms | 145148 KB | Output is correct |
4 | Correct | 59 ms | 145216 KB | Output is correct |
5 | Correct | 537 ms | 145356 KB | Output is correct |
6 | Correct | 550 ms | 145192 KB | Output is correct |
7 | Correct | 145 ms | 145268 KB | Output is correct |
8 | Correct | 487 ms | 145272 KB | Output is correct |
9 | Incorrect | 1450 ms | 145268 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 53 ms | 145228 KB | Output is correct |
2 | Correct | 56 ms | 145208 KB | Output is correct |
3 | Correct | 58 ms | 145148 KB | Output is correct |
4 | Correct | 59 ms | 145216 KB | Output is correct |
5 | Correct | 537 ms | 145356 KB | Output is correct |
6 | Correct | 550 ms | 145192 KB | Output is correct |
7 | Correct | 145 ms | 145268 KB | Output is correct |
8 | Correct | 487 ms | 145272 KB | Output is correct |
9 | Incorrect | 1450 ms | 145268 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 60 ms | 145212 KB | Output is correct |
2 | Incorrect | 53 ms | 145216 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 60 ms | 145212 KB | Output is correct |
2 | Incorrect | 53 ms | 145216 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 60 ms | 145212 KB | Output is correct |
2 | Incorrect | 53 ms | 145216 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 53 ms | 145228 KB | Output is correct |
2 | Correct | 56 ms | 145208 KB | Output is correct |
3 | Correct | 58 ms | 145148 KB | Output is correct |
4 | Correct | 59 ms | 145216 KB | Output is correct |
5 | Correct | 537 ms | 145356 KB | Output is correct |
6 | Correct | 550 ms | 145192 KB | Output is correct |
7 | Correct | 145 ms | 145268 KB | Output is correct |
8 | Correct | 487 ms | 145272 KB | Output is correct |
9 | Incorrect | 1450 ms | 145268 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 60 ms | 145212 KB | Output is correct |
2 | Incorrect | 53 ms | 145216 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 53 ms | 145228 KB | Output is correct |
2 | Correct | 56 ms | 145208 KB | Output is correct |
3 | Correct | 58 ms | 145148 KB | Output is correct |
4 | Correct | 59 ms | 145216 KB | Output is correct |
5 | Correct | 537 ms | 145356 KB | Output is correct |
6 | Correct | 550 ms | 145192 KB | Output is correct |
7 | Correct | 145 ms | 145268 KB | Output is correct |
8 | Correct | 487 ms | 145272 KB | Output is correct |
9 | Incorrect | 1450 ms | 145268 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 60 ms | 145212 KB | Output is correct |
2 | Incorrect | 53 ms | 145216 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 53 ms | 145228 KB | Output is correct |
2 | Correct | 56 ms | 145208 KB | Output is correct |
3 | Correct | 58 ms | 145148 KB | Output is correct |
4 | Correct | 59 ms | 145216 KB | Output is correct |
5 | Correct | 537 ms | 145356 KB | Output is correct |
6 | Correct | 550 ms | 145192 KB | Output is correct |
7 | Correct | 145 ms | 145268 KB | Output is correct |
8 | Correct | 487 ms | 145272 KB | Output is correct |
9 | Incorrect | 1450 ms | 145268 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |