当前位置:网站首页>Acwing 379. hide and seek problem solution (minimum path non repeating point coverage)
Acwing 379. hide and seek problem solution (minimum path non repeating point coverage)
2022-07-26 02:06:00 【Mr. Qiao Da】
AcWing 379. hide-and-seek 
Big guy problem solving original address
#include<bits/stdc++.h>
using namespace std;
const int N = 210, M = 61000;
bool d[N][N], st[N];
int n, m;
int match[N];
bool find(int u){
for(int i = 1; i <= n; i ++ ){
// Traverse all points to see which can be connected
if(d[u][i] && !st[i]){
st[i] = true;
int t = match[i];
if(t == 0 || find(t)){
match[i] = u;
return true;
}
}
}
return false;
}
int main()
{
cin>>n>>m;
for(int i = 0; i < m; i ++ ){
int a, b;
cin>>a>>b;
d[a][b] = true;
}
for(int k = 1; k <= n; k ++ ){
for(int i = 1; i <= n; i ++ ){
for(int j = 1; j <= n; j ++ ){
d[i][j] |= d[i][k] & d[k][j]; // Finding transitive closure , It is to connect a point on a road with all the points that can be connected behind
}
}
}
int res = 0;
for(int i = 1; i <= n; i ++ ){
memset(st, 0, sizeof st);
if(find(i)) res ++ ;
}
cout<<n - res <<endl;
return 0;
}
边栏推荐
- 国标GB28181协议视频平台EasyGBS消息弹框模式优化
- Qt程序美化之样式表的使用方法,Qt使用图片作为背景与控件透明化,Qt自定义按钮样式
- 登堂入室soc之编程基础环境变量设置
- 还在用==0 null equal 判断空值吗,对isEmpty 和 isBlank有多少了解呢
- Summary after reading "poor dad and rich dad"
- I.MX6UL核心模块使用连载-TF卡读写测试 (五)
- DQN Pytorch示例
- obsidian移动端PC段同步
- 1. Mx6ul core module serial use - touch screen calibration (IX)
- 餐饮连锁门店重塑增长背后的数字化转型
猜你喜欢

How to choose cloud note tool? What can I do with cloud notes?

I.MX6UL核心模块使用连载-查看系统信息 (二)

Digital transformation behind the reshaping growth of catering chain stores

MySQL transaction isolation level

【2020】【论文笔记】磁控溅射法生长Bi2Te3/CoFeB双层异质结——

Implementation of C iterator

Worthington核酸酶、微球菌相关研究及测定方案

Kaggle registration method to solve the problem of man-machine verification

# Dest0g3 520迎新赛(更新中)

flutter 下 grpc list没有Setter 方法 ,如何使用相关属性
随机推荐
1. Mx6ul core module use serial RTC test (XII)
PHP Alipay transfer to Alipay account
How to install opengauss manually (non om mode)
QT program beautification of the use of style sheets, QT uses pictures as the background and transparency of controls, QT custom button styles
【2021】【论文笔记】红外及THz下的细胞膜生物效应——效应是现象,作用是机理——THz对医学的好处
[C language brush leetcode] 814. Binary tree pruning (m)
Navica工具把远程MySQL导入到本地MySQL数据库
Proto conversion dart | project uses protobuf | fluent uses grpc
Video game quiz? I think it's useless. It's better to do these well!
[paper reading] coat: CO scale conv attentional image transformers
How to choose cloud note tool? What can I do with cloud notes?
I.MX6UL核心模块使用连载-Iot-6ULX核心模块简要介绍 (一)
国标GB28181协议视频平台EasyGBS消息弹框模式优化
proto转换Dart | 项目使用Protobuf | flutter 使用grpc
[Verilog digital system design (Xia Yuwen) 3 ----- basic concepts of Verilog syntax 1]
MPLS知识点
[Android development IOS series] Language: swift vs kotlin
本地仓库导致的报错
C# 迭代器的实现
Phoenix中常用shell操作