제출 #659856

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
6598562022-11-19 14:21:43meiron03은행 (IZhO14_bank)C++17
100 / 100
215 ms12600 KiB
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> point;
#define Rd(r) freopen(r, "r", stdin);
#define Wt(w) freopen(w, "w", stdout);
#define x first
#define y second
#define INF 1<<30
#define MAXI 20
vector<int> MASK[MAXI];
int dp[1 << MAXI], rem[1 << MAXI], mark[1 << MAXI], y;
bool flag = false;
bool ZiwenZapper(int n, int m, int a[], int b[]) {
y = 0;
mark[0] = 1;
for(int mask = 0; mask < (1 << m); mask++){
for(int i = 0; i < m; i++){
if(mark[mask ^ (1 << i)] and (mask & (1 << i))){
int last = dp[mask ^ (1 << i)];
int curr = rem[mask ^ (1 << i)] + b[i];
if(curr > a[last]) continue;
dp[mask] = last + (curr == a[last] ? 1 : 0);
rem[mask] = (curr == a[last] ? 0 : curr);
mark[mask] = 1;
}
}
if(dp[mask] == n) y = 1;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...