Contest Duration: - (local time) (90 minutes) Back to Home

Submission #524308

Source Code Expand

Copy
```using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
static void Main(){
Sol mySol =new Sol();
mySol.Solve();
}
}

class Sol{
public void Solve(){

int root=0;
parent=new int[N];
XX=new int[N];
dfs(root,-1,0);
//Console.WriteLine(String.Join(" ",XX));
//Console.WriteLine(String.Join(" ",parent));
Dictionary<int,long> DD=new Dictionary<int,long>();
for(int i=0;i<N;i++){
DD[XX[i]]+=1;
}

long ans=0;
HashSet<int> H=new HashSet<int>();
foreach(var k in DD.Keys){
if(H.Contains(k))continue;
if(DD.ContainsKey(k^X)){
ans+=DD[k]*DD[k^X];
}
}

Console.WriteLine(ans);

}
int N,X;
List<Pair>[] E;
int[] parent;
int[] XX;
void dfs(int now, int par,int x){
parent[now]=par;
XX[now]=x;
foreach(var v in E[now]){
if(v.Pos!=par){
dfs(v.Pos,now,x^v.Cost);
}
}
}

public Sol(){
var d=ria();
N=d[0];X=d[1];
E=new List<Pair>[N];
for(int i=0;i<N;i++)E[i]=new List<Pair>();
for(int i=0;i<N-1;i++){
var dd=ria();
}
}

class Pair{
public int Pos;
public int Cost;
public Pair(int pos,int cost){
Pos=pos;Cost=cost;
}
}

}
```

#### Submission Info

Submission Time 2015-10-10 22:09:48+0900 C - エックスオア多橋君 kuuso C# (Mono 3.2.1.0) 0 2029 Byte WA 615 ms 48676 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 100
Status
 AC × 3
 AC × 24 WA × 3
Set Name Test Cases
Case Name Status Exec Time Memory
subtask0_sample_01.txt AC 147 ms 11080 KB
subtask0_sample_02.txt AC 146 ms 11056 KB
subtask0_sample_03.txt AC 148 ms 11140 KB
subtask1_01.txt WA 152 ms 11028 KB
subtask1_02.txt WA 153 ms 11640 KB
subtask1_03.txt AC 613 ms 45168 KB
subtask1_04.txt AC 615 ms 45108 KB
subtask1_05.txt AC 613 ms 45108 KB
subtask1_06.txt WA 436 ms 48676 KB
subtask1_07.txt AC 501 ms 34848 KB
subtask1_08.txt AC 515 ms 34852 KB
subtask1_09.txt AC 537 ms 36788 KB
subtask1_10.txt AC 524 ms 36668 KB
subtask1_11.txt AC 154 ms 11640 KB
subtask1_12.txt AC 152 ms 11648 KB
subtask1_13.txt AC 510 ms 34904 KB
subtask1_14.txt AC 543 ms 34900 KB
subtask1_15.txt AC 235 ms 17736 KB
subtask1_16.txt AC 199 ms 17756 KB
subtask1_17.txt AC 195 ms 17796 KB
subtask1_18.txt AC 254 ms 17824 KB
subtask1_19.txt AC 241 ms 17740 KB
subtask1_20.txt AC 250 ms 17800 KB
subtask1_21.txt AC 242 ms 17748 KB
subtask1_22.txt AC 195 ms 17796 KB
subtask1_23.txt AC 188 ms 17832 KB
subtask1_24.txt AC 189 ms 17788 KB