AtCoder Regular Contest 045
問題文
省略
省略
C++に変換後のコードはこちら
int N, X, A[1d5], B[1d5], C[1d5];
wgraph<int> g;
int dp[1d5];
{
ll res = 0;
map<int,int> mp;
rd(N,X,(A--,B--,C)(N-1));
g.setEdgeRootedTree(N,N-1,A,B,C,0,1);
rep(i,N){
rep(j,g.es[i]) dp[g.edge[i][j]] = dp[i] ^ g.cost[i][j];
if(mp.count(dp[i])) res += mp[dp[i]];
mp[dp[i]^X]++;
}
wt(res);
}
Current time: 2024年05月06日11時33分03秒
Last modified: 2019年11月23日19時13分47秒 (by laycrs)
Tags: Competitive_Programming_Incomplete AtCoder AtCoder_Regular_Contest ARC045 ARC_C
トップページに戻る
Logged in as: unknown user (not login)