Submission #1281228

#TimeUsernameProblemLanguageResultExecution timeMemory
1281228arman.khachatryanKlasika (COCI20_klasika)C++20
33 / 110
2987 ms4556 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll Q; cin >> Q; vector<ll> xorToRoot(Q + 2); xorToRoot[1] = 0; vector<ll> nodes; nodes.push_back(0); ll nodeCount = 1; while (Q--) { string type; cin >> type; if (type == "Add") { ll x, y; cin >> x >> y; nodeCount++; xorToRoot[nodeCount] = xorToRoot[x] ^ y; nodes.push_back(xorToRoot[nodeCount]); } else { ll a, b; cin >> a >> b; ll ans = 0; for (ll val : nodes) { ans = max(ans, xorToRoot[a] ^ val); } cout << ans << "\n"; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...