当前位置:网站首页>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);
}边栏推荐
- How to solve the 2003 error of MySQL in Linux
- Partial mock of static class of phpunit operation
- 面试中问最常问的海量数据处理你拿捏了没?
- Software testing - you may not understand the basic theoretical knowledge
- 【目标跟踪】|stark配置 win otb
- 最受欢迎的30款开源软件
- Yurun multidimensional makes efforts in the charity field and bravely resists the corporate public welfare banner
- [try to hack] cookies and sessions
- Segment tree and tree array template (copy and paste are really easy to use)
- 给定一个数在序列中求最大异或值(01字典)
猜你喜欢

Have you grasped the most frequently asked question in the interview about massive data processing?

传承中华美德,关注中老年大健康,育润奶粉敬老情浓

Digital twin energy system, creating a "perspective" in the low-carbon era

Wechat applet development reserve knowledge

Bloom filter:

软件测试——基础理论知识你都不一定看得懂

MATLAB 最远点采样(FPS)

布隆过滤器:

Inherit Chinese virtues, pay attention to the health of the middle-aged and the elderly, and Yurun milk powder has strong respect for the elderly

Selenium file upload method
随机推荐
Image migration and data migration synchronization of old and new servers with different Alibaba cloud accounts
How MySQL queries character set codes of tables
Digital twin energy system, creating a "perspective" in the low-carbon era
POJ 1975 (传递闭包)
Distributed | several steps of rapid read / write separation
牛客小Bai月赛52 D 环上食虫(尺取+st表)
人脸识别4-百度商用方案调研
分布式 | 几步快速拥有读写分离
Web Scraping with Beautiful Soup for Data Scientist
3H proficient in opencv (IX) - the simplest face detection
金鱼哥RHCA回忆录:DO447构建高级作业工作流--使用事实缓存提高性能
What is the SRM system? How do I apply the SRM system?
Does MySQL support foreign keys
MaxCompute字符串替换函数-replace
What are the usage scenarios for locks in MySQL
小程序容器是什么技术?能助力物联网企业红海突围?
mac安装php7.2
What is the MySQL query view command
Uploading files using AutoIT
Segment tree and tree array template (copy and paste are really easy to use)