Submission #291126

#TimeUsernameProblemLanguageResultExecution timeMemory
291126penguinhackerKlasika (COCI20_klasika)C++17
33 / 110
5059 ms9020 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ar array const int mxN=2e5; int n=1, val[mxN]; vector<int> adj[mxN]; int dfs(int u, int x) { int MX=x^val[u]; for (int v: adj[u]) { MX=max(MX, dfs(v, x)); } return MX; } int main() { ios::sync_with_stdio(0); cin.tie(0); int q; cin >> q; while(q--) { string type; cin >> type; int a, b; cin >> a >> b; if (type=="Add") { --a; val[n]=val[a]^b; adj[a].push_back(n); ++n; } if (type=="Query") { --a, --b; cout << dfs(b, val[a]) << "\n"; } } 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...