Submission #839167

#TimeUsernameProblemLanguageResultExecution timeMemory
839167DeathIsAweBank (IZhO14_bank)Cpython 3
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int dp[10000000],rem[10000000]; int main() { int n,m; cin >> n >> m; vector<int> people(n),notes(m); for (int i=0;i<n;i++) { cin >> people[i]; } for (int i=0;i<m;i++) { cin >> notes[i]; } int miss,maxdp,temp,temp2; dp[0]=0; rem[0]=0; for (int i=1;i<(int)pow(2,m);i++) { temp2=1; maxdp=-1; for (int j=0;j<m;j++) { if ((i^temp2)<i && maxdp<dp[(i^temp2)]) { temp=(i^temp2); maxdp=dp[(i^temp2)]; miss=j; } temp2*=2; } if (rem[temp]+notes[miss]==people[maxdp]) { dp[i]=maxdp+1; rem[i]=0; } else { dp[i]=maxdp; rem[i]=rem[temp]+notes[miss]; } if (dp[i]==n) { cout << "YES"; return 0; } } cout << "NO"; }

Compilation message (stderr)

File "bank.py", line 2
    using namespace std;
          ^
SyntaxError: invalid syntax