hiho week 33 register

Ended

Participants:140

Verdict:Accepted
Score:100 / 100
Submitted:2015-02-14 21:50:49

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>
#include <algorithm>
#include <map>
#include <vector>
#include <iostream>
#include <sstream> 
using namespace std;
#define LL long long 
vector<int> g[10010];
int n,m;
int mk[10010];
int p[10010];
int f;
void dfs(int x,int c){
   if(f)return;
    mk[x]=c;
    for(int i=0;i<g[x].size();i++){
        int y=g[x][i];
        if(mk[y]==0){
           dfs(y,-c);
        }else {
            if(mk[y]==mk[x]){
                f=1;
                return;
            }
               
        }
    }
} 
int main(){
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX