[Offer收割]编程练习赛36 register

Ended

Participants:242

Verdict:Wrong Answer
Score:0 / 100
Submitted:2017-11-19 14:29:00

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*n k ac cn
d=1 x y  d=2 x
*/
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int Max=50010*2;
int fat[Max],ran[Max];
void Init(int n)//
{
    for(int i=0; i<=n; i++)
    {
        fat[i]=i;//
        ran[i]=0;//0 1 2
    }
    return;
}
int Find(int x)//+
{
    if(x==fat[x])
        return fat[x];
    int y=Find(fat[x]);
        ran[x]=(ran[x]+ran[fat[x]])%3;//
    return fat[x]=y;//
}
int Union(int typ,int x,int y)//
{
    int x1=Find(x);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX