Submission #1068270

#TimeUsernameProblemLanguageResultExecution timeMemory
1068270vjudge1Bank (IZhO14_bank)C++17
0 / 100
59 ms596 KiB
#include<bits/stdc++.h> #define pb push_back #define pf push_front #define mp make_pair #define F first #define S second #define ff first #define ss second #define str string #define ll long long #define ull unsigned ll #define ld long double #define pll pair<ll,ll> #define plll pair<ll,pll> #define pllll pair<pll,pll> #define pld pair<ld,ld> #define vl vector<ll> #define vll vector<pll> #define vlll vector<plll> #define vllll vector<pllll> #define vb vector<bool> #define sz size() #define fr front() #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define bk back(); //#pragma GCC target( "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") //#pragma GCC optimize("Ofast,unroll-loops,fast-math,O3") using namespace std; const ld pi=acos(-1.0); const ll e5=1e5; const ll e6=1e6; const ll e9=1e9; const ll inf=1e18; const ll mod=1e9+7; const ll mod2=998244353; const ll MOD=106710087877475399; const ll N=1e3+10; ll bpm(ll x,ll y,ll m){if(y==0)return 1%m;if(y==1)return x%m;ll p=bpm(x,y/2,m); if(y%2==0)return p*p%m;else return p*p%m*x%m;} ll bp(ll x,ll y){if(y==0)return 1;if(y==1)return x;ll p=bp(x,y/2); if(y%2==0)return p*p;else return p*p*x;} ll a[N],b[N],dp[N*20]; void solve(){ ll n,m; cin>>n>>m; for(ll i=0;i<n;i++) cin>>a[i]; for(ll i=0;i<m;i++) cin>>b[i]; for(ll x=0;x<(1<<m);x++){ ll s=0; for(ll i=0;i<m;i++){ if((1<<i)&x) s+=b[i]; } dp[s]++; } sort(a+1,a+n+1); for(ll i=1;i<=n;i++){ if(!dp[a[i]]){ cout<<"NO"; return;} for(ll x=a[i];x<=2e4;x++) dp[x]-=dp[x-a[i]]; } cout<<"YES"; } int main(/*Aldk*/){ ios_base::sync_with_stdio(false); cin.tie(NULL); freopen("bank.in", "r", stdin); freopen("bank.out ", "w", stdout); //cout<<setprecision(6)<<fixed; ll test=1; //cin>>test; for(ll i=1;i<=test;i++){ //cout<<"Case "<<i<<":\n"; solve(); //cout<<'\n'; } return 0; }

Compilation message (stderr)

bank.cpp: In function 'int main()':
bank.cpp:65:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   65 |     freopen("bank.in", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:66:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   66 |     freopen("bank.out ", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...