Submission #737849

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7378492023-05-07 20:41:10baneBank (IZhO14_bank)C++17
100 / 100
125 ms8524 KiB
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define debug(x) cout << (#x) << " is " << (x) << '\n'
#else
#define debug(x) 42
#endif
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
vector<int>a(n), b(m);
for (int i = 0; i < n; i++)cin >> a[i];
for (int j = 0; j < m; j++)cin >> b[j];
int f[(1 << m)], p[(1 << m)];
memset(f, -1, sizeof(f));
memset(p, -1, sizeof(p));
bool ok = 0;
f[0] = p[0] = 0;
for (int mask = 0; mask < (1 << m); mask++){
for (int last = 0; last < m; last++){
if (!((1 << last) & mask))continue;
int previous = mask ^ (1 << last);
if (p[previous] == -1)continue;
int man = p[previous];
int money = f[previous] + b[last];
if (money < a[man]){
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...