Submission #792067

# Submission time Handle Problem Language Result Execution time Memory
792067 2023-07-24T14:42:29 Z ToniB Uplifting Excursion (BOI22_vault) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 805;
const int K = MAXN * MAXN / 4;

int m, a[MAXN];
int dp[MAXN][MAXN * MAXN / 2];
ll L;
int main(){
	cin >> m >> L;
	for(int i = 0; i < 2 * m + 1; ++i) cin >> a[i];
	for(int i = 0; i < 2 * m + 1; ++i){
		// dp[i][j] = max{dp[i - 1][j - x * (i - m)] + x}
		for(int j = 0; j < MAXN * MAXN / 2; ++j){
			dp[i][j] = -1e9;
			for(int x = 0; x <= a[i]; ++x){
				if(j - x * (i - m) >= 0 && j - x * (i - m) < MAXN * MAXN / 2){
					if(i) dp[i][j] = max(dp[i][j], dp[i - 1][j - x * (i - m)] + x);
					else if(j - x * (i - m) == K) dp[i][j] = max(dp[i][j], x);
				}
			}
		}
	}
	if(L + K < 0 || L + K >= MAXN * MAXN / 2) cout << "impossible\n";
	else if(dp[2 * m][L + K] < 0) cout << "impossible\n";
	else cout << dp[2 * m][L + K];
	return 0;
}

Compilation message

vault.cpp:8:1: error: 'll' does not name a type
    8 | ll L;
      | ^~
vault.cpp: In function 'int main()':
vault.cpp:10:14: error: 'L' was not declared in this scope
   10 |  cin >> m >> L;
      |              ^