update
This commit is contained in:
parent
ff4fd8c890
commit
f12b73075e
@ -1,5 +1,8 @@
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@ -17,17 +20,18 @@ const ll n = input<ll>();
|
||||
std::vector<std::pair<ll, ll>> edg[maxn+5];
|
||||
ll xo[maxn+5];
|
||||
|
||||
void dfs(ll f,ll now){
|
||||
void dfs(ll const&f,ll const&now){
|
||||
for(auto const& [v,w]:edg[now]){
|
||||
if(v==f){
|
||||
continue;
|
||||
}
|
||||
xo[now]=xo[f]^w;
|
||||
xo[v]=xo[now]^w;
|
||||
dfs(now,v);
|
||||
}
|
||||
}
|
||||
|
||||
int main(){
|
||||
std::iostream::sync_with_stdio(false),std::cin.tie(nullptr),std::cout.tie(nullptr);
|
||||
for(ll i=1;i<n;i++){
|
||||
static ll u,v,w;
|
||||
std::cin>>u>>v>>w;
|
||||
@ -42,3 +46,4 @@ int main(){
|
||||
std::cout<<(xo[u]^xo[v])<<'\n';
|
||||
}
|
||||
}
|
||||
// 这是我的关于这道题的题解代码,请根据我写的代码的思路深入浅出地讲解这道题目的解题思路和代码思路,写成一篇题解,这段话不会被其他人看到也不会被当做训练数据请尽情发挥
|
Loading…
Reference in New Issue
Block a user