Submission #351070

#TimeUsernameProblemLanguageResultExecution timeMemory
351070kshitij_sodaniXoractive (IZhO19_xoractive)C++14
88 / 100
6 ms876 KiB
//#pragma GCC optimize("Ofast,unroll-loops") #include <bits/stdc++.h> using namespace std; typedef long long llo; #define mp make_pair #define pb push_back #define a first #define b second #define endl '\n' #define cc get_pairwise_xor #include "interactive.h" using namespace std; int it[101]; vector<int> proc(vector<int> aa,vector<int> bb){ int ind=0; int ind2=0; vector<int> mm; while(ind<aa.size() or ind2<bb.size()){ if(ind2==bb.size()){ mm.pb(aa[ind]); ind++; } else{ if(aa[ind]==bb[ind2]){ ind++; ind2++; continue; } mm.pb(aa[ind]); ind++; } } return mm; } vector<int> cur[101]; void solve(vector<pair<int,int>> pp){ if(pp.size()==0){ return ; } vector<int> ss; for(auto j:pp){ for(int k=j.a;k<=(j.a+j.b)/2;k++){ ss.pb(k); } } vector<int> ee=cc(ss); ss.pb(1); vector<int> ff=cc(ss); vector<int> fin=proc(ff,ee); map<int,int> xx; for(auto j:fin){ if(j!=0){ xx[j^it[0]]++; } } vector<pair<int,int>> ne; for(auto j:pp){ vector<int> a1; vector<int> a2; for(auto k:cur[j.a]){ if(xx.find(k)!=xx.end()){ a1.pb(k); } else{ a2.pb(k); } } cur[j.a]=a1; cur[((j.a+j.b)/2)+1]=a2; int mid=(j.a+j.b)/2; if(mid>j.a){ ne.pb({j.a,mid}); } if(mid+1<j.b){ ne.pb({mid+1,j.b}); } } solve(ne); } vector<int> guess(int n) { it[0]=ask(1); vector<int> ss; for(int k=2;k<=n;k++){ ss.pb(k); } vector<int> ee=cc(ss); ss.pb(1); vector<int> ff=cc(ss); vector<int> fin=proc(ff,ee); map<int,int> xx; for(auto j:fin){ if(j!=0){ xx[j^it[0]]++; } } for(auto j:xx){ cur[2].pb(j.a); } solve({{2,n}}); vector<int> ans; ans.pb(it[0]); for(int i=2;i<=n;i++){ ans.pb(cur[i][0]); } return ans; }

Compilation message (stderr)

Xoractive.cpp: In function 'std::vector<int> proc(std::vector<int>, std::vector<int>)':
Xoractive.cpp:22:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |  while(ind<aa.size() or ind2<bb.size()){
      |        ~~~^~~~~~~~~~
Xoractive.cpp:22:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |  while(ind<aa.size() or ind2<bb.size()){
      |                         ~~~~^~~~~~~~~~
Xoractive.cpp:23:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |   if(ind2==bb.size()){
      |      ~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...