hiho week 51 register

Ended

Participants:269

Verdict:Accepted
Score:100 / 100
Submitted:2015-06-26 17:36:57

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>
#define MAXN (1<<14)
#define MAXM (1<<15)
int e[MAXN][2];
int path[MAXM];
void Create(int n)
{
    int left,right;
    left=n>>1;
    right=n&1;
    e[left][right]=1;
}
int pathSize;
void Dfs(int u,int n)
{
    int v;
    int pow=1<<(n-2);
    while(e[u][0]+e[u][1]>0)
    {
        if(e[u][0]==1)
        {
            e[u][0]=0;
            v=(u&(pow-1))<<1;
            Dfs(v,n);
        }
        if(e[u][1]==1)
        {
            e[u][1]=0;
            v=((u&(pow-1))<<1)+1;
            Dfs(v,n);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX