제출 #374595

#제출 시각아이디문제언어결과실행 시간메모리
374595nicolaalexandraXoractive (IZhO19_xoractive)C++14
94 / 100
5 ms492 KiB
#include <bits/stdc++.h> #include "interactive.h" using namespace std; vector <int> v,w; map <int,int> f,poz; int sol[110],a[110]; int n,i; /*int ask (int poz){ return a[poz]; } vector <int> get_pairwise_xor (vector <int> positions){ vector <int> sol; for (auto it : positions) for (auto it2 : positions) sol.push_back(a[it] ^ a[it2]); sort (sol.begin(), sol.end()); return sol; } */ vector <int> guess (int n){ sol[1] = ask(1); poz[sol[1]] = 1; for (int bit=0;bit<7;bit++){ v.clear(); f.clear(); for (int i=2;i<=n;i++){ if (i & (1<<bit)) v.push_back(i); } w = get_pairwise_xor(v); for (auto it : w) f[it]--; v.push_back(1); w = get_pairwise_xor(v); for (auto it : w) f[it]++; for (auto it : f){ if (!it.second) continue; poz[it.first ^ sol[1]] += (1<<bit); } } for (auto it : poz) sol[it.second] = it.first; vector <int> ans; for (int i=1;i<=n;i++) ans.push_back(sol[i]); return ans; } /*int main (){ ifstream cin ("date.in"); ofstream cout ("date.out"); cin>>n; for (i=1;i<=n;i++) cin>>a[i]; vector <int> ans = guess (n); for (auto it : ans) cout<<it<<" "; return 0; } */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...