Submission #501414

#TimeUsernameProblemLanguageResultExecution timeMemory
501414IOI_champion_in_1980Bank (IZhO14_bank)C++14
0 / 100
1084 ms204 KiB
#include <bits/stdc++.h> #include <math.h> typedef long long ll; using namespace std; ll i, j, t, a, n, m, b, c, d, f, g; int main() { ios::sync_with_stdio(0); cin.tie(0); cin>>n>>m; vector <int> vn(n); vector <int> vm(m); for (a=0; a<n; a++) { cin>>vn[a]; } for (a=0; a<m; a++) { cin>>vm[a]; } if (n>m) { cout<<"NO"<<endl; return 0; } vector <int> vc(m); for (a=0; a<m; a++) vc[a]=a; do { int c=0, jem=0; for (a=0; a<m; a++) { jem=jem+vm[vc[a]]; if (jem==vn[c]) { jem=0; c++; } if (jem>vn[c]) { c=0; break; } } if (c==n) { cout<<"YES"<<endl; return 0; } } while(next_permutation(vc.begin(), vc.end())); cout<<"NO"<<endl; } /* 1 5 8 4 2 5 1 3 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...