Submission #1017780

#TimeUsernameProblemLanguageResultExecution timeMemory
1017780vjudge1Klasika (COCI20_klasika)C++17
33 / 110
5017 ms6844 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int M = 1e5 + 1; int ans,xx,val[M]; vector<int> nei[M]; void dfs(int u) { ans=max(ans,val[u]^xx); for (int i:nei[u]) dfs(i); } signed main() { int q; cin>>q; int nd=1; while (q--) { string s; cin>>s; if (s=="Add") { int x,y; cin>>x>>y; val[++nd]=val[x]^y; nei[x].push_back(nd); } else { int a,b; cin>>a>>b; ans=0,xx=val[a]; dfs(b); cout<<ans<<endl; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...