hiho week 215 register

Ended

Participants:185

Verdict:Accepted
Score:100 / 100
Submitted:2018-08-15 19:36:18

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<cstdio>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>
#include<fstream>
using namespace std;
vector<int>g[100000 + 5];
int vis[100000 + 5];
bool flag = false;
void dfs(int n, int fa){
    vis[n] = 1;
    if(flag)return;
    for(int i = 0; i < g[n].size(); i++){
        if(!vis[g[n][i]])dfs(g[n][i], n);
        else if(vis[g[n][i]] == 1){
            flag = true;
            break;
        }
    }
    vis[n] = 2;
}
int main(){
//  freopen("data.txt", "r", stdin);
//  ifstream cin("data.txt");
    ios::sync_with_stdio(false);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX