# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
337888 | kutbilim_one | Bank (IZhO14_bank) | C++14 | 527 ms | 12012 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;
#define endl '\n'
#define all(x) x.begin(), x.end()
#define int long long
signed main(){
ios_base::sync_with_stdio(false);
cin.tie();
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 maxx = *max_element(all(a));
vector<int> pass[1 + maxx];
for(int bin = 1; bin < (1 << m); bin++){
int i = 0, sum = 0, temp = bin;
while(temp){
if(temp & 1) sum += b[i];
temp >>= 1;
i++;
}
if(sum <= maxx) pass[sum].push_back(bin);
}
Compilation message (stderr)
# | 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... |