当前位置:网站首页>[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;
}
边栏推荐
- [cloud native] IVX low code development was introduced into Tencent map and previewed online
- # MySQL 七种连接方式图解
- ASEMI整流桥KBPC3510,KBPC3510封装,KBPC3510应用
- kaggle猫狗数据集开源——用于经典CNN分类实战
- 硬件开发与市场产业
- A detailed explanation of throughput, QPS, TPS, concurrency and other high concurrency indicators
- 基本的SELECT语句
- Mondriaans's dream (state compression DP)
- ACL实验演示(Huawei路由器设备配置)
- 国际象棋机器人夹断7岁男孩手指,原因是「棋手违反安全规则」?
猜你喜欢

Tianyi cloud web application firewall (edge cloud version) supports the detection and interception of Apache spark shell command injection vulnerabilities

SQL中去去重的三种方式

leetcode:1206. 设计跳表【跳表板子】

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

【模板】线段树 1

第17周自由入侵 指针练习--输出最大值

Ascend target detection and recognition - customize your own AI application

Spark unified memory partition

硬件开发与市场产业

How to set IP for layer 2 management switches
随机推荐
Hardware development and market industry
ACL experiment demonstration (Huawei router device configuration)
AI zhetianchuan DL regression and classification
the loss outweighs the gain! Doctors cheated 2.1 million yuan and masters cheated 30000 yuan of talent subsidies, all of which were sentenced!
GAN (Generative Adversarial Network,GAN)生成式对抗网络
云渲染-体积云【理论基础与实现方案】
Tianyi cloud web application firewall (edge cloud version) supports the detection and interception of Apache spark shell command injection vulnerabilities
跨站点请求伪造(CSRF)
如何使用 align-regexp 对齐 userscript 元信息
Week 16 OJ practice 1 calculates the day of the year
图解用户登录验证流程,写得太好了!
Come on developer! Not only for the 200000 bonus, try the best "building blocks" for a brainstorming
AI遮天传 ML-集成学习
JS 递归 斐波那契数列 深克隆
Comparison between agile development and Devops
Week 17 free intrusion pointer exercise - output maximum
Mondriaans's dream (state compression DP)
#夏日挑战赛# OpenHarmony基于JS实现的贪吃蛇
我们被一个 kong 的性能 bug 折腾了一个通宵
如何快速使用 ELisp 进行插件编写