Submission #3680

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
36802013-08-31 07:39:13pl0892029Cactus? Not cactus? (kriii1_C)C++98
0 / 1
0 ms1868 KiB
#include <cstdio>
int groupNumber[100001];
int groupCount[100001];
bool isSameSet(int a,int b) {
return groupNumber[a] == groupNumber[b];
}
void setUnion(int a,int b) {
if( groupCount[a] < groupCount[b] ) {
groupCount[b] += groupCount[a];
groupCount[a] = 0;
groupNumber[a] = b;
}
else {
groupCount[a] += groupCount[a];
groupCount[b] = 0;
groupNumber[b] = a;
}
}
int setFind(int n) {
if( groupCount[n] == 0 ) {
groupNumber[n] = setFind(groupNumber[n]);
}
return groupNumber[n];
}
int main() {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...