# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
977994 | BentoOreo | Bank (IZhO14_bank) | C++14 | 1038 ms | 44440 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 ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
const ll INF = numeric_limits<ll>::max();
const int inf = numeric_limits<int>::max();
const char nl = '\n', sp = ' ';
ll cantor_hash(ll x, ll y){
ll ans = (((x + y) * (x + y + 1)) >> 1) + y;
// cout << ans << nl;
return ans;
}
unordered_map<ll,bool> vis;
bool f(int id, ll mask, ll val, int N, vector<ll> &salary, vector<ll> &billz ){
if(vis.count(cantor_hash(mask,val))){
return vis[cantor_hash(mask,val)];
} else {
if(id == N){
return true;
} else if(val == 0){
return f(id + 1,mask,salary[id + 1], N, salary, billz);
} else {
int mx = upper_bound(billz.begin(),billz.end(), val) - billz.begin();
bool flag = false;
for(int i = 0; i < mx; i++){
if((mask & (1 << i)) != 0){
# | 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... |