#include using namespace std; using ll=long long; bool bit(int S, int k){ return (S>>k)&1; } int main(){ const int N=19; const int U=1<> B(N, vector(N, false)); for (int i=0; i> L; for (int j=0; j> a; B[i][a-1]=true; } } vector popcount(U, 0); for (int S=1; S<(1<>1]+(S&1); } vector DP0(U, 0), DP1(U, 0); for (int S=U-1; S>=0; S--){ if (popcount[S]==N){ DP0[S]=1; continue; } int t=0; for (int j=0; j