# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
875361 | MisterReaper | Bank (IZhO14_bank) | C++17 | 96 ms | 8800 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
pair <int, int> dp[1 << 20];
#define ONLINE_JUDGE
void solve() {
fill(dp, dp + (1 << 20), pair <int, int> {-1, 0});
int n, m;
cin >> n >> m;
vector <int> a(n);
for(int &i : a)
cin >> i;
vector <int> b(m);
for(int &i : b)
cin >> i;
dp[0] = {0, 0};
for(int mask = 1; mask < (1 << m); mask++) {
for(int i = 0; i < m; i++) {
if((mask >> i) & 1) {
auto [num, left] = dp[mask ^ (1 << i)];
if(num == -1)
continue;
if(left + b[i] == a[num]) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |