当前位置:网站首页>POJ 1975 (transitive closure)
POJ 1975 (transitive closure)
2022-06-29 17:56:00 【eva_ can(not)survive】
Median Weight Bead - POJ 1975 - Virtual Judgehttps://vjudge.net/problem/POJ-1975#author=SCLchuck It is conceivable that when the number of water droplets is greater than or less than n/2 Can be satisfied when
int d[150][150];
void solve() {
memset(d, 0, sizeof(d));
int n, m;
int x, y;
scanf("%d %d", &n, &m);
for (int i = 1; i <= m; i++) {
scanf("%d %d", &x, &y);
d[x][y] = 1;
}
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];
}
}
}
int ans = 0;
for (int i = 1; i <= n; i++) {
int tmp1 = 0, tmp2 = 0;
for (int j = 1; j <= n; j++) {
if (i == j)
continue;
tmp1 += d[i][j];
tmp2 += d[j][i];
}
if (tmp1 > n / 2 || tmp2 > n / 2)
ans++;
}
printf("%d\n", ans);
}边栏推荐
- 国外LEAD赚钱,做个网站真的很简单
- 阿里云不同账号新旧服务器镜像迁移数据迁移同步
- What is a SCM system? What are the advantages of a supply chain management system?
- Visio annotation, annotation location
- SSH protocol learning notes
- Two controller layer interface authentication methods
- 最受欢迎的30款开源软件
- Selenium file upload method
- Yurun multidimensional makes efforts in the charity field and bravely resists the corporate public welfare banner
- Xiaomai technology x hologres: high availability of real-time data warehouse construction of ten billion level advertising
猜你喜欢

Matlab farthest point sampling (FPS)

Opencv+yolo-v3 for target tracking

Opencv+YOLO-V3实现目标跟踪

ABC253 D FizzBuzz Sum Hard(容斥定理)

VB.Net读写NFC Ntag标签源码

mysql. What is the concept of sock

How MySQL queries character set codes of tables

Visio annotation, annotation location
![Split palindrome string [dp + DFS combination]](/img/7b/221b000984977508f849e19802c2c2.png)
Split palindrome string [dp + DFS combination]

How to solve MySQL 1045 error in Linux
随机推荐
最长异或路径(dfs+01trie)
育润多维发力慈善领域,勇抗企业公益大旗
回文子串的最大长度(字符串哈希+二分)
What are the usage scenarios for locks in MySQL
3h精通OpenCV(九)-最简单的人脸检测
使用autoIt 上传文件
Selenium file upload method
js两个一维数组合并并去除相同项(整理)
SRM系统可以为企业带来什么价值?
ISO 32000-2 international standard 7.7
第42期:MySQL 是否有必要多列分区
Createstore for Redux source code analysis
On adding and subtracting dates
人脸识别4-百度商用方案调研
selenium 组合键操作
测试dble split功能执行+导入耗时shell脚本参考
Two controller layer interface authentication methods
基于STM32F103ZET6库函数独立看门狗(IWDG)实验
SRM系统是什么系统?如何应用SRM系统?
面试中问最常问的海量数据处理你拿捏了没?