hiho week 271 register

Ended

Participants:68

Verdict:Accepted
Score:100 / 100
Submitted:2019-09-08 13:42:34

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 <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <stack>
#include <deque>
using namespace std;
typedef long long ll;
int root[100001] = {0}; 
bool vi[100001] = {0}; 
int find(int x, int dep)
{
//  cout << x << " " << dep << endl; 
    if(!vi[x])
    {
        vi[x] = true;
        return find(root[x], dep + 1);
    }
    return dep;
}
int main()
{
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++)
    {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX