Submission #256908

#TimeUsernameProblemLanguageResultExecution timeMemory
256908blacktulipKlasika (COCI20_klasika)C++17
0 / 110
243 ms17528 KiB
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> using namespace std; typedef long long lo; typedef pair< lo,lo > PII; #define fi first #define se second #define mp make_pair #define endl "\n" #define pb push_back #define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define FOR for(int i=1;i<=n;i++) #define mid ((start+end)/2) #define ort ((bas+son)/2) const lo inf = 1000000000000000000; const lo KOK = 100000; const lo LOG = 30; const lo li = 500005; const lo mod = 1000000007; int n,m,b[li],a[li],k,flag,t,say=1,nodee=1,visit[li][5],xorr[li]; int cev; char s[10]; vector<int> v,vec; inline void build_trie(){ int node=1; for(int i=0;i<(int)v.size();i++){ if(visit[node][v[i]])node=visit[node][v[i]]; else{ visit[node][v[i]]=++nodee; node=nodee; } } } inline void ask_trie(){ int node=1; for(int i=0;i<(int)v.size();i++){ if(visit[node][!v[i]]){node=visit[node][!v[i]];vec.pb(1);} else if(visit[node][v[i]]){node=visit[node][v[i]];vec.pb(0);} } } int main(void){ scanf("%d",&t); while(t--){ int x,y; scanf("%s %d %d",s,&x,&y); if(s[0]=='A'){ xorr[++say]=(xorr[x]^y); int at=xorr[say]; v.clear(); while(at){ v.pb(at%2); at/=2; } while((int)v.size()<30)v.pb(0); reverse(v.begin(),v.end()); build_trie(); continue; } int at=xorr[x]; v.clear(); while(at){ v.pb(at%2); at/=2; } while((int)v.size()<30)v.pb(0); reverse(v.begin(),v.end()); vec.clear(); ask_trie(); reverse(vec.begin(),vec.end()); int ans=0; for(int i=0;i<(int)vec.size();i++){ if(vec[i]==1)ans=(ans|(1<<i)); } printf("%d\n",ans); } return 0; }

Compilation message (stderr)

klasika.cpp: In function 'int main()':
klasika.cpp:52:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&t);
  ~~~~~^~~~~~~~~
klasika.cpp:55:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s %d %d",s,&x,&y);
   ~~~~~^~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...