제출 #362708

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
3627082021-02-04 07:32:07wind_reaper은행 (IZhO14_bank)C++17
100 / 100
639 ms90468 KiB
#include <bits/stdc++.h>
using namespace std;
const int MXN = 20;
const int MX = 1000;
vector<int> pos[MXN*MX+1];
vector<vector<int>> dp(MXN, vector<int>(1 << MXN, -1));
int n, m;
vector<int> a;
bool solve(int idx, int mask){
if(idx == n) return 1;
if(dp[idx][mask] != -1){
return dp[idx][mask];
}
bool ans = 0;
for(int nmask : pos[a[idx]]){
if((nmask & mask) == 0)
ans = ans | solve(idx+1, mask|nmask);
}
return dp[idx][mask] = ans;
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//dp[i][mask] -> is it possible to cover all employees till i using mask notes
cin >> n >> m;
a.resize(n);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

컴파일 시 표준 에러 (stderr) 메시지

bank.cpp: In function 'bool solve(int, int)':
bank.cpp:21:23: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   21 |  return dp[idx][mask] = ans;
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...