bzoj1703[Usaco2007 Mar]Ranking the Cows 奶牛排名
2017-06-04 18:11
459 查看
大水题,明显传递闭包,直接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 ; 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) 4000 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); }
相关文章推荐
- 【bzoj1703】[Usaco2007 Mar]Ranking the Cows 奶牛排名
- bzoj:1703: [Usaco2007 Mar]Ranking the Cows 奶牛排名
- 【BZOJ】1703: [Usaco2007 Mar]Ranking the Cows 奶牛排名
- bzoj 1703: [Usaco2007 Mar]Ranking the Cows 奶牛排名【bitset+Floyd传递闭包】
- Bzoj 1703: [Usaco2007 Mar]Ranking the Cows 奶牛排名 传递闭包,bitset
- BZOJ 1703 [Usaco2007 Mar]Ranking the Cows 奶牛排名 bitset优化
- 【dfs】BZOJ1703-[Usaco2007 Mar]Ranking the Cows 奶牛排名
- BZOJ1703: [Usaco2007 Mar]Ranking the Cows 奶牛排名
- 【BZOJ1703】【usaco2007margold】ranking the cows 奶牛的魅力排名
- BZOJ 1703 Ranking the Cows 奶牛排名 (传递闭包)
- bzoj1638 [Usaco2007 Mar]Cow Traffic 奶牛交通
- bzoj 1704: [Usaco2007 Mar]Face The Right Way 自动转身机
- bzoj 3375: [Usaco2004 Mar]Paranoid Cows 发疯的奶牛
- 【BZOJ1720】[Usaco2006 Jan]Corral the Cows 奶牛围栏 双指针法
- bzoj 3386: [Usaco2004 Nov]Til the Cows Come Home 带奶牛回家
- bzoj1638 [Usaco2007 Mar]Cow Traffic 奶牛交通
- [BZOJ1638][Usaco2007 Mar]Cow Traffic 奶牛交通
- bzoj 1704: [Usaco2007 Mar]Face The Right Way 自动转身机 -- 贪心
- bzoj 1638: [Usaco2007 Mar]Cow Traffic 奶牛交通(拓扑排序?+DP)
- [Usaco2007 Mar][BZOJ1638] Cow Traffic 奶牛交通|动态规划