Submission #370955

#TimeUsernameProblemLanguageResultExecution timeMemory
370955casperwangXoractive (IZhO19_xoractive)C++14
100 / 100
3 ms512 KiB
#include "interactive.h"
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
#define debug(args...) kout("[ " + string(#args) + " ]", args)
void kout() { cerr << endl; }
template <class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ',kout(b...); }
template <class T> void pary(T L, T R) { while (L != R) cerr << *L << " \n"[++L==R]; }

const int MAXN = 100;
int n;
vector <int> ans;
map <int,int> pos;

vector<int> guess(int N) {
  ans.clear(), ans.resize(N);
  ans[0] = ask(1);
  for (int i = 0; (1<<i) < N; i++) {
    vector <int> G;
    for (int j = 1; j <= N-1; j++)
      if (j & (1<<i)) G.pb(j+1);
    vector <int> exp = get_pairwise_xor(G);
    G.pb(1);
    vector <int> all = get_pairwise_xor(G);
    int j = 0;
    for (int k = 0; k < exp.size(); k++, j++)
      while (all[j] != exp[k])
        pos[all[j++] ^ ans[0]] |= (1<<i);
    while (j < all.size())
      pos[all[j++] ^ ans[0]] |= (1<<i);
  }
  for (auto [v, p] : pos) 
    if (v != ans[0])
      ans[p] = v;
	return ans;
}

Compilation message (stderr)

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:26:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     for (int k = 0; k < exp.size(); k++, j++)
      |                     ~~^~~~~~~~~~~~
Xoractive.cpp:29:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     while (j < all.size())
      |            ~~^~~~~~~~~~~~
Xoractive.cpp:32:13: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   32 |   for (auto [v, p] : pos)
      |             ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...