Submission #39100

#TimeUsernameProblemLanguageResultExecution timeMemory
39100mrtsima22은행 (IZhO14_bank)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int b[1000003],n,m,s[1000003],s[1000003]; int a[1000003],d[23][1000003]; string ans="NO"; int main(){std::ios::sync_with_stdio(false); cin>>n>>m; for(int i=0;i<n;i++) { cin>>b[i]; b[i]+=b[i-1]; } for(int i=0;i<m;i++) { cin>>a[i]; } for(int i=0;i<(1<<m);i++) { for(int j=0;j<m;j++) { if(!((i>>j)&1)) { s[i|(1<<j)]=s[i]+a[j]; } } } d[0][0]=1; for(int i=0;i<=n;i++) { for(int j=0;j<(1<<m);j++) { if(!d[i][j]) { continue; } if(i==n) { ans="YES"; break; } if(b[i]==s[j]) { d[i+1][j]=1; } for(int t=0; t<m; t++) { if(!((j>>t)&1)) { d[i][j|(1<<t)]=1; } } } } cout<<ans<<endl; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

Compilation message (stderr)

bank.cpp:3:40: error: redefinition of 'int s [1000003]'
 int b[1000003],n,m,s[1000003],s[1000003];
                                        ^
bank.cpp:3:20: note: 'int s [1000003]' previously declared here
 int b[1000003],n,m,s[1000003],s[1000003];
                    ^