제출 #849991

#제출 시각아이디문제언어결과실행 시간메모리
849991Ahmed57Uplifting Excursion (BOI22_vault)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int dp[2][505000*2+1],arr[301],br = 505000,n,m; signed main(){ ios_base::sync_with_stdio(false);cin.tie(0); cin>>m>>n; for(int i = 0;i<2*m+1;i++){ cin>>arr[i]; } long long l = 5050000 for(int i = 2*m+1;i>=0;i--){ for(int j = 0;j<=505000*2-(i-(2*m+1))*100;j++){ if(i==2*m+1){ if(j==n+br){ dp[i&1][j] = 0; }else{ dp[i&1][j] = -1e9; } continue; } int ans = -1e9; for(int e = 0;e<=arr[i];e++){ if(j+e*(i-m)>505000*2)break; if(j+e*(i-m)<0)continue; ans = max(ans,dp[!(i&1)][j+e*(i-m)]+e); } dp[i&1][j] = ans; } } long long vl = dp[0][505000]; if(vl<0)cout<<"impossible\n"; else cout<<vl<<endl; }

컴파일 시 표준 에러 (stderr) 메시지

vault.cpp: In function 'int main()':
vault.cpp:12:5: error: expected ',' or ';' before 'for'
   12 |     for(int i = 2*m+1;i>=0;i--){
      |     ^~~
vault.cpp:12:23: error: 'i' was not declared in this scope
   12 |     for(int i = 2*m+1;i>=0;i--){
      |                       ^
vault.cpp:11:15: warning: unused variable 'l' [-Wunused-variable]
   11 |     long long l = 5050000
      |               ^