BZOJ 2530 Poi2011 Party 构造
来源:互联网 发布:qq视频变声软件 编辑:程序博客网 时间:2024/04/20 05:47
题目大意:给定一张
每次找一对没有连边的点对将其删掉
由于这对点之间没有连边,因此两个点不可能都存在于团中,也就是说我至少删掉了
那么不超过
剩余的点构成了一个团,大小
时间复杂度
#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#define M 3030using namespace std;int n,m;bool a[M][M],v[M];int main(){ int i,j,x,y,cnt=0; cin>>n>>m; for(i=1;i<=m;i++) { scanf("%d%d",&x,&y); a[x][y]=a[y][x]=true; } for(i=1;i<=n;i++) if( !v[i] ) for(j=i+1;j<=n;j++) if( !v[j] && !a[i][j] ) { v[i]=v[j]=true; break; } for(i=1;i<=n;i++) { if(!v[i]) printf("%d%c",i,(++cnt)==n/3?'\n':' '); if(cnt==n/3) break; } return 0;}
0 0
- BZOJ 2530 Poi2011 Party 构造
- [构造] BZOJ 2530 [Poi2011]Party
- BZOJ 2530: [Poi2011]Party
- bzoj 2530: [Poi2011]Party
- bzoj 2530: [Poi2011]Party
- 2530: [Poi2011]Party
- 【BZOJ】【P2530】【Poi2011】【Party】【题解】【水题】
- BZOJ2530 [Poi2011]Party
- BZOJ2530: [Poi2011]Party
- 洛谷 3524 [POI2011]IMP-Party
- [bzoj 2526]Poi2011 Inspection
- [bzoj 2525]Poi2011 Dynamite
- [BZOJ 2277]Poi2011 Strongbox
- 【BZOJ 2527】 [Poi2011]Meteors
- BZOJ 2529 Poi2011 Sticks
- BZOJ 2217 Poi2011 Lollipop
- BZOJ 2525: [Poi2011]Dynamite
- BZOJ 2527: [Poi2011]Meteors
- prototype与[[prototype]]
- 我的Java开发学习之旅------>Java经典排序算法之插入排序
- Ubuntu,mac查看端口命令
- POJ 3660 Cow Contest (Floyd求传递闭包)
- android 倒计时处理
- BZOJ 2530 Poi2011 Party 构造
- sudo apt-get remove vim-common不成功,提示被锁Could not get lock /var/lib/dpkg/lock
- 简单的几行小代码,实现Android程序布局替换。
- UINavigationController和UITabBarController合用[转载比较好理解]
- Sensor信号输出YUV、RGB、RAW DATA、JPEG 4种方式区别
- Unity design patterns and concepts, looking for good sources
- Payment Terms 付款条件
- C++12.2 隐含的this指针(不懂)、mutable数据成员
- 我曾经面试过这样一个问题