Submission #672932

#TimeUsernameProblemLanguageResultExecution timeMemory
672932ReLiceBank (IZhO14_bank)C++14
100 / 100
193 ms94760 KiB
#include<bits/stdc++.h> using namespace std; #define endl "\n" #define ll long long #define ld long double #define int long long #define pb push_back #define sz size() #define fr first #define sc second void start(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } const int N=1e3+3; vector <vector <ll>> dp(N); vector <ll> v,v2; ll n,m; ll vis[25][1500000]; void check(ll id,ll a){ if(id==n){ cout<<"YES"<<endl; exit(0); } vis[id][a]=1; for(auto i : dp[v[id]]){ if((a^i)!=(a+i) || vis[id+1][a^i])continue; check(id+1,a^i); } } main(){ start(); ll i,j,b,mx=-1; cin>>n>>m; for(i=0;i<n;i++){ cin>>b; v.pb(b); mx=max(mx,b); } ll c=1; dp[0].pb(0); for(i=0;i<m;i++){ cin>>b; v2.pb(b); for(j=mx;j>=0;j--){ if(dp[j].sz>0){ for(auto i1 : dp[j]){ if(j+b<=mx) dp[j+b].pb(i1+c); } } } c*=2; } check(0,0); cout<<"NO"<<endl; }

Compilation message (stderr)

bank.cpp:32:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   32 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...