hiho week 291 register

Ended

Participants:37

Verdict:Accepted
Score:100 / 100
Submitted:2020-01-25 21:29:16

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
#include<bits/stdc++.h>
using namespace std;
struct node{
    int f;
    node* link;
}root[1010];
int N,K;
void findFather(int x){
    node* temp=root[x].link;
    while(temp!=NULL){
        if(root[temp->f].f<0){
            root[temp->f].f=x;
            findFather(temp->f);
        }
        temp=temp->link;
    }
    return;
}
int main()
{
    ios::sync_with_stdio(false);
    int i,j,k,l;
    node* temp;
    while(cin>>N>>K){
        for(i=1;i<=N;i++){
            root[i].f=-1;
            root[i].link=NULL;
        }
        root[K].f=0;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX