hiho week 271 register

Ended

Participants:68

Verdict:Accepted
Score:100 / 100
Submitted:2019-09-13 06:48:35

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 <vector>
#include <string>
#include <string.h>
#include <algorithm>
#include <set>
using namespace std;
static size_t n=0;
static vector<size_t> numVec;
size_t DFS(size_t index, size_t depth)
{
    if(numVec.at(index) == 0) return depth;
    size_t next = numVec.at(index);
    numVec.at(index) = 0;
    return DFS(next, depth+1);
}
size_t GetMaxSet()
{
    size_t maxval = 0;
    for(size_t i=1; i<=n; ++i) maxval = max(maxval, DFS(i, 0));
    return maxval;
}
int main()
{
    cin >> n;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX