Submission #978952

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9789522024-05-10 04:33:00SkaBank (IZhO14_bank)C++14
100 / 100
76 ms8792 KiB
#include <bits/stdc++.h>
using namespace std;
const int N = 20;
int n, m;
int a[N], b[N];
pair<int, int> f[1 << N];
void solve() {
for (int mask = 1; mask <= 1 << m; ++mask) {
bool ok = false;
for (int i = 0; i < m; ++i) {
if ((mask >> i & 1) == 0) {
continue;
}
int prev = mask ^ 1 << i;
if (f[prev].first == -1) {
continue;
}
if (f[prev].second + b[i] < a[f[prev].first]) {
f[mask] = {f[prev].first, f[prev].second + b[i]};
ok = true;
break;
} else if (f[prev].second + b[i] == a[f[prev].first]) {
f[mask] = {f[prev].first + 1, 0};
if (f[mask].first == n) {
cout << "YES\n";
return;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...