답안 #577817

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
577817 2022-06-15T09:33:05 Z kingfran1907 Uplifting Excursion (BOI22_vault) C++14
0 / 100
1518 ms 166984 KB
#include <bits/stdc++.h>
#define X first
#define Y second

using namespace std;
typedef long long llint;

const int maxn = 220;
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

vault.cpp: In function 'int main()':
vault.cpp:33:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |  scanf("%d%lld\n", &n, &l);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~
vault.cpp:35:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   35 |   scanf("%d", niz+i);
      |   ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 62 ms 166860 KB Output is correct
2 Correct 60 ms 166868 KB Output is correct
3 Correct 62 ms 166976 KB Output is correct
4 Correct 68 ms 166872 KB Output is correct
5 Correct 527 ms 166976 KB Output is correct
6 Correct 608 ms 166980 KB Output is correct
7 Correct 147 ms 166956 KB Output is correct
8 Correct 542 ms 166984 KB Output is correct
9 Incorrect 1518 ms 166984 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 62 ms 166860 KB Output is correct
2 Correct 60 ms 166868 KB Output is correct
3 Correct 62 ms 166976 KB Output is correct
4 Correct 68 ms 166872 KB Output is correct
5 Correct 527 ms 166976 KB Output is correct
6 Correct 608 ms 166980 KB Output is correct
7 Correct 147 ms 166956 KB Output is correct
8 Correct 542 ms 166984 KB Output is correct
9 Incorrect 1518 ms 166984 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 60 ms 166904 KB Output is correct
2 Incorrect 62 ms 166968 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 60 ms 166904 KB Output is correct
2 Incorrect 62 ms 166968 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 60 ms 166904 KB Output is correct
2 Incorrect 62 ms 166968 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 62 ms 166860 KB Output is correct
2 Correct 60 ms 166868 KB Output is correct
3 Correct 62 ms 166976 KB Output is correct
4 Correct 68 ms 166872 KB Output is correct
5 Correct 527 ms 166976 KB Output is correct
6 Correct 608 ms 166980 KB Output is correct
7 Correct 147 ms 166956 KB Output is correct
8 Correct 542 ms 166984 KB Output is correct
9 Incorrect 1518 ms 166984 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 60 ms 166904 KB Output is correct
2 Incorrect 62 ms 166968 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 62 ms 166860 KB Output is correct
2 Correct 60 ms 166868 KB Output is correct
3 Correct 62 ms 166976 KB Output is correct
4 Correct 68 ms 166872 KB Output is correct
5 Correct 527 ms 166976 KB Output is correct
6 Correct 608 ms 166980 KB Output is correct
7 Correct 147 ms 166956 KB Output is correct
8 Correct 542 ms 166984 KB Output is correct
9 Incorrect 1518 ms 166984 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 60 ms 166904 KB Output is correct
2 Incorrect 62 ms 166968 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 62 ms 166860 KB Output is correct
2 Correct 60 ms 166868 KB Output is correct
3 Correct 62 ms 166976 KB Output is correct
4 Correct 68 ms 166872 KB Output is correct
5 Correct 527 ms 166976 KB Output is correct
6 Correct 608 ms 166980 KB Output is correct
7 Correct 147 ms 166956 KB Output is correct
8 Correct 542 ms 166984 KB Output is correct
9 Incorrect 1518 ms 166984 KB Output isn't correct
10 Halted 0 ms 0 KB -