意甲冠军:被判处无向图无环和连接无处不在 思考:并检查集合,trap 您可能有一个直接输入0 0 并且....合并的时候按某一个方向会爆栈,爆了好几次...下次考虑一下直接递归找祖先吧 #include<cstdio> #include<iostream> #include<algorithm> #include<cstring> using namespace std; const int N =1e5+1e2; int fa[N]; int getf(i…
Conquer a New Region Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 657 Accepted Submission(s): 179 Problem Description The wheel of the history rolling forward, our king conquered a new region i…
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3659 #include<cstdio> #include<iostream> #include<cstring> #include<vector> #include<algorithm> using namespace std; ; int p[maxn],num[maxn]; long long int sum…
A. Learning Languages time limit per test:2 seconds memory limit per test:256 megabytes The "BerCorp" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered wi…
Farm Irrigation Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4977 Accepted Submission(s): 2137 Problem Description Benny has a spacious farm land to irrigate. The farm land is a rectangle…