Submission #526615

#TimeUsernameProblemLanguageResultExecution timeMemory
526615peuchXoractive (IZhO19_xoractive)C++11
100 / 100
3 ms384 KiB
#include "interactive.h" #include<bits/stdc++.h> using namespace std; vector<int> guess(int n) { vector<int> ans(n); map<int, int> id; ans[n - 1] = ask(n); for(int i = 0; i < 7; i++){ vector<int> qry; for(int j = 1; j < n; j++) if((1 << i) & j) qry.push_back(j); if(qry.empty()) continue; qry.push_back(n); vector<int> p1 = get_pairwise_xor(qry); qry.pop_back(); vector<int> p2 = get_pairwise_xor(qry); int it = p1.size() - 1; while(!p2.empty()){ if(p1[it] == p2.back()){ swap(p1[it], p1[p1.size() - 1]); p1.pop_back(); p2.pop_back(); } it--; } for(int j = 1; j < p1.size(); j++) id[p1[j] ^ ans[n - 1]] |= (1 << i); } map<int, int> :: iterator it; for(it = id.begin(); it != id.end(); it++) ans[it->second - 1] = it->first; return ans; }

Compilation message (stderr)

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:27:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |   for(int j = 1; j < p1.size(); j++)
      |                  ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...