Submission #256934

#TimeUsernameProblemLanguageResultExecution timeMemory
256934blacktulipKlasika (COCI20_klasika)C++17
0 / 110
285 ms28160 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 int long long #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);} else break; } } main(void){ //~ freopen("att.txt","r",stdin); //~ freopen("at.txt","w",stdout); scanf("%lld",&t); for(int i=1;i<=35;i++)v.pb(0); build_trie(); while(t--){ int x,y; scanf("%s %lld %lld",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()<35)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()<35)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|(1ll<<i)); } printf("%lld\n",ans); } return 0; }

Compilation message (stderr)

klasika.cpp:53:10: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(void){
          ^
klasika.cpp: In function 'int main()':
klasika.cpp:56:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&t);
  ~~~~~^~~~~~~~~~~
klasika.cpp:61:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s %lld %lld",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...