Submission #377091

#TimeUsernameProblemLanguageResultExecution timeMemory
377091eulerdesojaXoractive (IZhO19_xoractive)C++14
Compilation error
0 ms0 KiB
#include "interactive.h" using namespace std; #define ll long long #define pb push_back #define sz(x) int(x.size()) typedef pair<int,int>ii; typedef vector<int> vi; vi guess(int n){ int a0=ask(1); vi ans; multiset<int> tab[7]; for(int k=0;k<7;k++){ vi ax,ax1; ax1.pb(1); for(int i=1;i<n;i++){ if(i&(1<<k)){ ax.pb(i+1); ax1.pb(i+1); } } vi q=get_pairwise_xor(ax); vi q1=get_pairwise_xor(ax1); int i=0,i1=0; while(!q[i])i++; while(!q1[i1])i1++; while(i<sz(q) && i1<sz(q1)){ if(q[i] != q1[i1]){ tab[k].insert({(q1[i1]^a0)}); i1+=2; } else{ i+=2; i1+=2; } } } for(int i=n-1;i>0;i--){ vi aux; for(int j=0;j<7;j++){ if(i&(1<<j))aux.pb(j); } int ini=aux[0]; for(auto it=tab[ini].begin();it!=tab[ini].end();it++){ int cur=*it; bool ok=true; for(int k=1;k<sz(aux);k++)if(!tab[aux[k]].count(cur)){ ok=false; break; } if(ok){ ans.pb(cur); for(int k=0;k<sz(aux);k++){ tab[aux[k]].erase(tab[aux[k]].find(cur)); } break; } } } ans.pb(a0); reverse(ans.begin(),ans.end()); return ans; }

Compilation message (stderr)

Xoractive.cpp: In function 'vi guess(int)':
Xoractive.cpp:14:2: error: 'multiset' was not declared in this scope
   14 |  multiset<int> tab[7];
      |  ^~~~~~~~
Xoractive.cpp:2:1: note: 'std::multiset' is defined in header '<set>'; did you forget to '#include <set>'?
    1 | #include "interactive.h"
  +++ |+#include <set>
    2 | using namespace std;
Xoractive.cpp:14:11: error: expected primary-expression before 'int'
   14 |  multiset<int> tab[7];
      |           ^~~
Xoractive.cpp:33:5: error: 'tab' was not declared in this scope
   33 |     tab[k].insert({(q1[i1]^a0)});
      |     ^~~
Xoractive.cpp:49:15: error: 'tab' was not declared in this scope
   49 |   for(auto it=tab[ini].begin();it!=tab[ini].end();it++){
      |               ^~~
Xoractive.cpp:66:2: error: 'reverse' was not declared in this scope
   66 |  reverse(ans.begin(),ans.end());
      |  ^~~~~~~