Submission #1128443

#TimeUsernameProblemLanguageResultExecution timeMemory
1128443koukirocksXoractive (IZhO19_xoractive)C++20
100 / 100
4 ms508 KiB
#include <bits/stdc++.h> #include "interactive.h" // #include "grader.cpp" #define S second #define F first #define all(x) (x).begin(),(x).end() using namespace std; vector<int> guess(int n) { vector <int> ans(n); ans[0]=ask(1); map<int,int> fin; for (int k=0;k<7;k++) { vector<int> pos; for (int i=2;i<=n;i++) { if (i&(1<<k)) pos.push_back(i); } if (pos.empty()) break; vector<int> ins=get_pairwise_xor(pos); pos.push_back(1); vector<int> out=get_pairwise_xor(pos); map<int,int> cnt; vector<int> xst; for (int i:ins) { cnt[i]++; } for (int i:out) { if (cnt[i] or i==0) cnt[i]--; else xst.push_back(i); } sort(all(xst)); vector<int> nxst; for (int i=0;i<xst.size();i+=2) nxst.push_back(xst[i]); for (int i:nxst) fin[i^ans[0]]^=(1<<k); } for (auto x:fin) ans[x.S-1]=x.F; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...