【随机】 FZU 2141 Sub-Bipartite Graph
来源:互联网 发布:斜顶开天窗 知乎 编辑:程序博客网 时间:2024/05/29 13:23
点击打开链接
这都行!求正解!@九爷
#include <cstdio>#include <cstring>#include <cstdlib>#include <string>#include <iostream>#include <algorithm>#include <sstream>#include <cmath>using namespace std;#include <queue>#include <stack>#include <set>#include <vector>#include <deque>#include <map>#define cler(arr, val) memset(arr, val, sizeof(arr))#pragma comment(linker, "/STACK:102400000,102400000")typedef long long LL;const int MAXN = 500+1;const int MAXM = 140000;const int INF = 0x3f3f3f3f;const int mod = 1000000007;int a[10087],b[10087],point[109];void out(int x,int n){ int sum=0,ans[101]; for(int i=1;i<=n;i++) if(point[i]==x) ans[sum++]=i; printf("%d",sum); for(int i=0;i<sum;i++) printf(" %d",ans[i]); puts("");}int main(){#ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout);#endif int n,m,t; cin>>t; while(t--) { cin>>n>>m; for(int i=0;i<m;i++) cin>>a[i]>>b[i]; int ans=0; while(ans<m/2) { ans=0; for(int i=1;i<=n;i++) point[i]=rand()&1; for(int i=0;i<m;i++) ans+=point[a[i]]^point[b[i]]; } out(1,n); out(0,n); } return 0;}
0 0
- 【随机】 FZU 2141 Sub-Bipartite Graph
- FZU 2141Sub-Bipartite Graph
- FZU 2141 Sub-Bipartite Graph
- fzu 2141 Sub-Bipartite Graph (贪心)
- FZU 2141 Sub-Bipartite Graph【贪心】
- FZU 2141 Sub-Bipartite Graph 贪心
- fzu 2141 Sub-Bipartite Graph 贪心 二分图构建
- 【贪心】 FOJ 2141 Sub-Bipartite Graph
- FZU2141 Sub-Bipartite Graph 贪心
- Bipartite Graph
- Bipartite graph/network学习
- HDU5313.Bipartite Graph
- hdu5313--Bipartite Graph
- hdu 5313 Bipartite Graph
- hdu-5313 Bipartite Graph
- hdu 5313 Bipartite Graph
- hdu5354 Bipartite Graph
- HDU 5313 Bipartite Graph
- 阶乘拆分成素数指数因子的形式
- Objective-C中的@property和@synthesize用法
- LeetCode[Tree]: Construct Binary Tree from Preorder and Inorder Traversal
- 论文案的重要性
- HTTP请求中POST与GET的区别
- 【随机】 FZU 2141 Sub-Bipartite Graph
- 图片对H5游戏性能的影响及感谢Andres Loew和他的TexturePacker
- 学习JPA——Hibernate Annotation使用实例
- 从编写到运行:unix脚本
- 字母重排找单词
- gravity 和 LayoutGravity 以及padding / android:layout_margin
- openflow简明学习笔记
- linux中touch命令的常见用法
- 初学lucene之lucene4.x与lucene3.x控制索引域和存储域的方式对比