#include<stdio.h> #define N 1100000 struct node { int x,y; }f[N],pre[N]; int find(int x) { if(x!=pre[x].x) { int h=pre[x].x; pre[x].x=find(h); pre[x].y=(pre[x].y+pre[h].y)%2; } return pre[x].x; } int main() { int t,m,n,i,j,k,flag,cou=0; scanf("…
#include<iostream> #include<cstring> #include<cstdio> using namespace std; +; int p[N]; int w[N]; int find(int x) { if(p[x]==x) return x; int root=find(p[x]); w[x]+=w[p[x]]; p[x]=root; return p[x]; } int n,m; int main() { while(~scanf(&q…
Background Professor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that they feature two different genders and that they only interact with bugs of the opposite gender. In his experiment, individual bugs and their in…
A Bug's Life Time Limit: 15000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 8528 Accepted Submission(s): 2745 Problem Description Background Professor Hopper is researching the sexual behavior of a rare…
Travel Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5441 Description Jack likes to travel around the world, but he doesn’t like to wait. Now, he is traveling in the Undirected Kingdom. There are n cities and m…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3038 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Description TT and FF are ... friends. Uh... very very good friends -________-b FF is a bad boy, he is always…
传送门 The Experience of Love Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 221 Accepted Submission(s): 91 Problem Description A girl named Gorwin and a boy named Vivin is a couple. They arriv…