제출 #701171

#제출 시각아이디문제언어결과실행 시간메모리
701171KiprasUplifting Excursion (BOI22_vault)C++17
0 / 100
1 ms468 KiB
#include <bits/stdc++.h> typedef long long ll; using namespace std; const ll maxN = 51; ll a[maxN*2+1]; ll dp[maxN^2*2]; int main() { ios_base::sync_with_stdio(0);cin.tie(nullptr); ll m, l; cin>>m>>l; fill(dp, dp+(int)(maxN^2*2), 0); for(int i = 0; i < m*2+1; i++){ cin>>a[i]; } for(int i = 0; i < m*2+1; i++){ for(int x = 0; x < a[i]; x++){ ll v = i-m; if(v<0){ for(int z = -min(maxN^2*2+1,l*2); z <= min(maxN^2*2+1,l*2); z++){ if((dp[z-v]!=0||z-v==0))dp[z]=dp[z-v]+1; } } else{ for(int z = min(maxN^2+1,2*l); z >= -min(maxN^2+1,2*l); z--){ if((dp[z-v]!=0||z-v==0))dp[z]=dp[z-v]+1; } } } } if(dp[l]>0)cout<<dp[l]; else cout<<"impossible"; return 0; }

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

vault.cpp: In function 'int main()':
vault.cpp:31:42: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   31 |                 for(int z = -min(maxN^2*2+1,l*2); z <= min(maxN^2*2+1,l*2); z++){
      |                                       ~~~^~
vault.cpp:31:68: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   31 |                 for(int z = -min(maxN^2*2+1,l*2); z <= min(maxN^2*2+1,l*2); z++){
      |                                                                 ~~~^~
vault.cpp:36:39: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   36 |                 for(int z = min(maxN^2+1,2*l); z >= -min(maxN^2+1,2*l); z--){
      |                                      ~^~
vault.cpp:36:64: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   36 |                 for(int z = min(maxN^2+1,2*l); z >= -min(maxN^2+1,2*l); z--){
      |                                                               ~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...