hiho week 118 register

Ended

Participants:1068

Verdict:Accepted
Score:100 / 100
Submitted:2016-10-02 21:10:52

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<cstdio>
#include<cstring>
const int N=505;
const int M=20005;
struct qq
{
    int x,y;
    int last;
}s[M];
int num,last[N];
int n,m;
void init (int x,int y)
{
    num++;
    s[num].x=x;
    s[num].y=y;
    s[num].last=last[x];
    last[x]=num;
    return ;
}
int f[N];
bool ooo[N];
bool check (int x)
{
    for (int u=last[x];u!=-1;u=s[u].last)
    {
        int y=s[u].y;
        if (ooo[y]==true) continue;
        ooo[y]=true;
        if (f[y]==-1||check(f[y])==true)
        {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX