当前位置:网站首页>[training Day2] sculpture
[training Day2] sculpture
2022-07-26 17:50:00 【SSL_ GYX】
Sculpture

Their thinking
Golden Classic pressure D P DP DP, set up f i f_i fi Indicates that the selection status is i i i Total number of schemes , Enumerate the last selected number j j j To transfer , The dynamic transfer equation is : f i = ∑ j ∈ i n f i − 1 < < j f_i=\sum^{n}_{j\in i}f_{i-1<<j} fi=j∈i∑nfi−1<<j\
code
#include<iostream>
#include<cstdio>
#define int long long
using namespace std;
int n,m;
int f[1<<21];
int a[30][30];
int g(int i)
{
int s=0;
while(i)
s+=i&1,i>>=1;
return s;
}
signed main()
{
cin>>n>>m;
for(int i=1;i<=m;i++)
{
int x,y;
scanf("%lld%lld",&x,&y);
a[x][y]=1;
}
f[0]=1;
for(int i=0;i<(1<<n);i++)
for(int j=0;j<n;j++)
if(i&(1<<j)&&!a[g(i)][j+1])
f[i]+=f[i-(1<<j)];
cout<<f[(1<<n)-1]<<endl;
}
边栏推荐
- Tree DP problem
- [300 opencv routines] 240. Shi Tomas corner detection in opencv
- (24) the top menu of blender source code analysis shows code analysis
- uni-app
- (25) top level menu of blender source code analysis blender menu
- 深度学习实验:Softmax实现手写数字识别
- Pay attention to the traffic safety warning of tourism passenger transport issued by the Ministry of public security
- Click hijacking attack
- GAN (Generative Adversarial Network,GAN)生成式对抗网络
- 国际大咖 VS 本土开源新星 | ApacheCon Asia 主题演讲议程全览
猜你喜欢

Redisdesktopmanager removes the upgrade prompt

Just this time! Talk about the technical solutions of distributed system in detail

(24)Blender源码分析之顶层菜单显示代码分析

CentOS installs docker and MySQL and redis environments

解决哈希冲突的几种方式

Interview with celebrities | open source is a double-edged sword for security -- Wei Jianfan, author of the Chinese translation of cathedral and market

Asemi rectifier bridge kbpc2510, kbpc2510 parameters, kbpc2510 specifications

【虚拟机数据恢复】意外断电导致XenServer虚拟机不可用,虚拟磁盘文件丢失的数据恢复案例

Cross Site Request Forgery (CSRF)

JS 函数作用域 变量声明提升 作用域链 不加var的变量,是全局变量
随机推荐
03 | implement usereducer and usestate
Spark unified memory partition
#夏日挑战赛# OpenHarmony基于JS实现的贪吃蛇
RedisDesktopManager去除升级提示
Centos安装docker以及mysql和redis环境
pip安装模块,报错
Spark数据格式UnsafeRow
【集训Day3】Reconstruction of roads
AI遮天传 ML-集成学习
图解用户登录验证流程,写得太好了!
【虚拟机数据恢复】意外断电导致XenServer虚拟机不可用,虚拟磁盘文件丢失的数据恢复案例
[cloud native kubernetes actual combat] kubeopertor installation tutorial
长征证券开户安全吗?
Heavy! The 2022 China open source development blue book was officially released
Open source kaggle cat and dog data set -- used in classic CNN classification practice
Sign up now | oar hacker marathon phase III midsummer debut, waiting for you to challenge
跨站脚本攻击(XSS)
How to use align regexp to align userscript meta information
Oracle is slow to perform a large number of DML operations. Is it the problem of CPU or hard disk?
Application of machine vision in service robot