hiho week 215 register

Ended

Participants:185

Verdict:Accepted
Score:100 / 100
Submitted:2018-08-14 20:33:55

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 <cstdio>
#include <cstring>
#define maxn 100010
int T, n, m, xx, yy;
int hd[maxn], cnt;
int used[maxn], ok;
struct E {
    int to, nxt;
} e[maxn];
void add(int x, int y) {
    e[++cnt].to = y;
    e[cnt].nxt = hd[x];
    hd[x] = cnt;
}
void dfs(int x) {
    used[x] = 1;
    for (int i = hd[x]; i; i = e[i].nxt) {
        if (used[e[i].to] == 1) ok = 1;
        else dfs(e[i].to);
        if (ok) return;
    }
    used[x] = 2;
}
int main() {
    #ifndef ONLINE_JUDGE
    freopen("215wk.in", "r", stdin);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX