제출 #128530

#제출 시각아이디문제언어결과실행 시간메모리
128530faustaadp은행 (IZhO14_bank)C++17
71 / 100
1068 ms5020 KiB
#include<bits/stdc++.h> typedef long long ll; #define pb push_back #define mp make_pair #define fi first #define se second using namespace std; ll n,m,i,a[22],b[22]; vector<ll> isi[22]; void hai(ll aa,ll bb) { if(aa==(m+1)) { if(bb==a[1]) { cout<<"YES\n"; exit(0); } } else { hai(aa+1,bb); hai(aa+1,bb+b[aa]); } } void cek(ll aa,ll bb,ll cc) { if(aa==(m+1)) { if(bb==a[i]) { isi[i].pb(cc); } } else { cek(aa+1,bb,cc); cek(aa+1,bb+b[aa],cc+(1<<(aa-1))); } } int main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin>>n>>m; for(i=1;i<=n;i++)cin>>a[i]; for(i=1;i<=m;i++)cin>>b[i]; if(1) { isi[0].pb(0); for(i=1;i<=n;i++) cek(1,0,0); for(i=1;i<=n;i++) { vector<ll> tem; ll ii,jj; for(ii=0;ii<isi[i-1].size();ii++) for(jj=0;jj<isi[i].size();jj++) if(!(isi[i-1][ii]&isi[i][jj])) tem.pb(isi[i-1][ii]|isi[i][jj]); isi[i]=tem; } if(isi[n].empty())cout<<"NO\n"; else cout<<"YES\n"; } else { hai(1,0); cout<<"NO\n"; } }

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

bank.cpp: In function 'int main()':
bank.cpp:56:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(ii=0;ii<isi[i-1].size();ii++)
             ~~^~~~~~~~~~~~~~~~
bank.cpp:57:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(jj=0;jj<isi[i].size();jj++)
              ~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...