记录编号 | 166598 | 评测结果 | AAAAAAAAAAAAAAAAAAAA | ||
---|---|---|---|---|---|
题目名称 | 2001.[HZOI 2015] 厕所里的OIer | 最终得分 | 100 | ||
用户昵称 | 是否通过 | 通过 | |||
代码语言 | C++ | 运行时间 | 0.077 s | ||
提交时间 | 2015-06-15 18:35:35 | 内存使用 | 9.96 MiB | ||
#define MAXN 50UL #include <cstdio> using namespace std; int not_[21],x,y,nw,n,m; unsigned long long f[1<<20]; int main(){ freopen("scr_chess.in","r",stdin); freopen("scr_chess.out","w",stdout); scanf("%d%d",&n,&m); nw=1<<n;f[0]=1; for(int i=1;i<=m;i++){ scanf("%d%d",&x,&y); not_[x]|=1<<(y-1); } for(int i=1;i<nw;i++){ int num=0; for(int j=i;j>0;j-=j&(-j)){ num++; } for(int j=i&(~not_[num]);j>0;j-=j&(-j)){ f[i]+=f[i&~(j&(-j))]; } } printf("%lld",f[nw-1]); return 0; }