Submission #1127443

#TimeUsernameProblemLanguageResultExecution timeMemory
1127443heeheeheehaawXoractive (IZhO19_xoractive)C++20
100 / 100
3 ms504 KiB
#include <bits/stdc++.h> #include "interactive.h" using namespace std; vector<int> guess(int n) { if(n <= 15) { vector<int> v(n); for(int i = 0; i < n; i++) v[i] = ask(i + 1); return v; } vector<int> v(n); v[0] = ask(1); map<int, int> poz; if(n == 1) return v; for(int bit = 6; bit >= 0; bit--) { vector<int> a; for(int i = 2; i <= n; i++) { if(((1 << bit) & i) != 0) a.push_back(i); } vector<int> a2 = a; a2.push_back(1); vector<int> b2 = get_pairwise_xor(a2); vector<int> b = get_pairwise_xor(a); map<int, int> mp; for(auto it : b2) mp[it]++; for(auto it : b) mp[it]--; mp[0]--; for(auto it : mp) { if(it.second == 0) continue; poz[it.first ^ v[0]] |= (1 << bit); } } for(auto it : poz) v[it.second - 1] = it.first; return v; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...