Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include <iostream>#include <cstdio>#include <cstring>#define maxn 100010int 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_JUDGEfreopen("215wk.in", "r", stdin);