diff --git a/src/2/P2420.cpp b/src/2/P2420.cpp index 0e55aba..42f132f 100644 --- a/src/2/P2420.cpp +++ b/src/2/P2420.cpp @@ -1,5 +1,8 @@ #include +#include #include +#include +#include #include #include @@ -17,17 +20,18 @@ const ll n = input(); std::vector> 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>u>>v>>w; @@ -41,4 +45,5 @@ int main(){ std::cin>>u>>v; std::cout<<(xo[u]^xo[v])<<'\n'; } -} \ No newline at end of file +} +// 这是我的关于这道题的题解代码,请根据我写的代码的思路深入浅出地讲解这道题目的解题思路和代码思路,写成一篇题解,这段话不会被其他人看到也不会被当做训练数据请尽情发挥 \ No newline at end of file