bzoj1703[Usaco2007 Mar]Ranking the Cows 奶牛排名
来源:互联网 发布:matlab矩阵绘制三维图 编辑:程序博客网 时间:2024/06/17 01:25
大水题,明显传递闭包,直接bitset优化即可,随手1A= =
#include<cstdio>#include<cstring>#include<algorithm>#include<bitset>#define fo(i,a,b) for(int i=a;i<=b;i++)#define fd(i,a,b) for(int i=a;i>=b;i--)using namespace std;const int N=1e3+5;int n,m;bitset<N> a[N]; int main(){ scanf("%d%d",&n,&m); fo(i,1,m) { int x,y; scanf("%d%d",&x,&y); a[x][y]=1; } fo(i,1,n) fo(j,1,n) if (a[j][i])a[j]|=a[i]; int ans=0; fo(i,1,n) fo(j,i+1,n) if (!a[i][j]&&!a[j][i])ans++; printf("%d\n",ans);}
阅读全文
0 0
- bzoj1703[Usaco2007 Mar]Ranking the Cows 奶牛排名
- 【bzoj1703】[Usaco2007 Mar]Ranking the Cows 奶牛排名
- BZOJ 1703 [Usaco2007 Mar]Ranking the Cows 奶牛排名 bitset优化
- BZOJ 1703 [Usaco2007 Mar]Ranking the Cows 奶牛排名 Floyd+bitset
- BZOJ 1703 Ranking the Cows 奶牛排名 (传递闭包)
- 1638: [Usaco2007 Mar]Cow Traffic 奶牛交通
- bzoj1638 [Usaco2007 Mar]Cow Traffic 奶牛交通
- [BZOJ1638][Usaco2007 Mar]Cow Traffic 奶牛交通
- 1638: [Usaco2007 Mar]Cow Traffic 奶牛交通
- 1638: [Usaco2007 Mar]Cow Traffic 奶牛交通
- POJ 3275 Ranking The Cows
- poj 3275 Ranking the Cows
- Poj 3275 Ranking the Cows
- poj 3275 Ranking The Cows
- 传递闭包——洛谷P2881 [USACO07MAR]排名的牛Ranking the Cows
- BZOJ 1638: [Usaco2007 Mar]Cow Traffic 奶牛交通
- bzoj2621 [Usaco2012 Mar]Cows in a Skyscraper奶牛乘电梯
- bzoj 3375: [Usaco2004 Mar]Paranoid Cows 发疯的奶牛
- hdoj 1014Uniform Generator
- JAVA的面向对象特性
- Linux下虚拟地址映射
- 设计模式七大原则
- Nginx 配置域名 .conf 文件
- bzoj1703[Usaco2007 Mar]Ranking the Cows 奶牛排名
- Lingo数据
- vim快捷键介绍
- 一步一步写算法(之排序二叉树)
- windows PHPStudy Apache 配置支持HTTPS
- USCAO-Section 1.3 Barn Repair
- Serializable 和serialVersionUID 的作用
- JAVA面向对象特性
- JDBC(一)