Submission #901070

#TimeUsernameProblemLanguageResultExecution timeMemory
901070RedSnow389Bank (IZhO14_bank)C++14
100 / 100
111 ms16984 KiB
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long #define ld long double #define fr(i,n) for(i=0;i<n;i++) #define fa(i,v) for(auto &i:v) #define yesno cout<<"YES"<<endl; else cout<<"NO"<<endl; #define vvl vector<vector<ll> > #define vl vector<ll> #define pll pair<ll,ll> #define vpll vector<pair<ll,ll> > #define vvpll vector<vector<pair<ll,ll> > > #define mp make_pair #define pb push_back #define rs resize #define cl(v) v.clear() #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define inf (ll)1e18 #define f1 first #define f2 second #define mod (ll)(1e9+7) int main(){ fastio ll n,m,i,j; cin>>n>>m; ll a[n], b[m]; fr(i,n) cin>>a[i]; fr(i,m) cin>>b[i]; vpll dp(1<<m, mp(0,-1)); //leftover, peple cov fr(i,(1<<m)) if(i){ fr(j,m) if((1<<j)&i){ if(dp[(1<<j)^i].f1+b[j]==a[dp[(1<<j)^i].f2+1] && dp[i].f2<dp[(1<<j)^i].f2+1){ dp[i].f2=dp[(1<<j)^i].f2+1; dp[i].f1=0; } else if(dp[(1<<j)^i].f1+b[j]<a[dp[(1<<j)^i].f2+1] && dp[i].f2<=dp[(1<<j)^i].f2){ dp[i].f2=dp[(1<<j)^i].f2; dp[i].f1=dp[(1<<j)^i].f1+b[j]; } } if(dp[i].f2==n-1) break; } if(i!=(1<<m)) yesno }

Compilation message (stderr)

bank.cpp: In function 'int main()':
bank.cpp:8:15: warning: macro expands to multiple statements [-Wmultistatement-macros]
    8 | #define yesno cout<<"YES"<<endl; else cout<<"NO"<<endl;
      |               ^~~~
bank.cpp:45:19: note: in expansion of macro 'yesno'
   45 |     if(i!=(1<<m)) yesno
      |                   ^~~~~
bank.cpp:45:5: note: some parts of macro expansion are not guarded by this 'if' clause
   45 |     if(i!=(1<<m)) yesno
      |     ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...