Submission #1281222

#TimeUsernameProblemLanguageResultExecution timeMemory
1281222arman.khachatryanKlasika (COCI20_klasika)C++20
0 / 110
214 ms5400 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; struct node{ ll h, val, p; }; int main() { ll t, a, b; cin>>t; ll tin=1, h; vector<node> v(t+1); v[1]={1, 0, 0}; queue<ll> q; q.push(0); while(t--){ string s; cin>>s>>a>>b; if(s=="Add"){ tin++; v[tin]={v[a].h+1, b^v[a].val, a}; if(h<v[tin].h){ while(!q.empty()){ q.pop(); } q.push(v[tin].val); h++; }else if(h==v[tin].h){ q.push(v[tin].val); } }else{ ll ans=0; queue<ll> p=q; while(!p.empty()){ ans=max(ans, p.front()); p.pop(); } 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...