Submission #344589

#TimeUsernameProblemLanguageResultExecution timeMemory
344589SeDunionXoractive (IZhO19_xoractive)C++17
100 / 100
5 ms492 KiB
#include "interactive.h" #include <bits/stdc++.h> using namespace std; vector<int> guess(int n) { vector <int> ans(n); ans[0] = ask(1); map<int,int> d; for (int i = 0 ; (1 << i) <= n ; ++ i) { //cout << i << endl; vector<int> p; for (int j = 2 ; j <= n ; ++ j) { if (j >> i & 1) { p.push_back(j); } } auto p1 = get_pairwise_xor(p); p.push_back(1); auto p2 = get_pairwise_xor(p); //for (int i : p) cout << i << " "; //cout << endl; //for (int i : p1) cout << i << " "; //cout << endl; //for (int i : p2) cout << i << " "; //cout << endl; map<int,int> mp; for (int j : p1) mp[j]--; for (int j : p2) mp[j]++; for (auto [a, b] : mp) if (b > 1) { //cout << a << " " << b << endl; d[a ^ ans[0]] |= (1 << i); } } for (auto [i, j] : d) { //cout << i << " " << j << " order" << endl; ans[j - 1] = i; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...