Submission #1216821

#TimeUsernameProblemLanguageResultExecution timeMemory
1216821Hectorungo_18Xoractive (IZhO19_xoractive)C++20
100 / 100
5 ms624 KiB
#include <bits/stdc++.h> #include"interactive.h" using namespace std; string abc = "abcdefghijklmnopqrstuvwxyz"; // #define int long long // int ask(int i){ // cout << "ask " << i << endl; // int a; // cin >> a; // return a; // } // vector<int> get_pairwise_xor(vector<int> pos){ // cout << "get "; // for(auto x :pos) cout << x << " "; // cout << endl; // int n = pos.size()*pos.size(); // vector<int> an(n); // for(int i = 0; i < n;i++){ // cin >> an[i]; // } // sort(an.begin(), an.end()); // return an; // } vector<int> guess(int n){ vector<int> v(n+1); v[1]=ask(1); int o = v[1]; map<int, int> pos; // if(n == 2){ // vector<int> ans = {v[1], v[2]}; // return ans; // } for(int i = 0; i < 7; i++){ int st = (1<<i); vector<int> a = {1}, b; for(int j = 2; j <= n; j++){ if(j&(st)){ a.push_back(j); b.push_back(j); } } if(b.size() ==0) break; vector<int> v = get_pairwise_xor(a); vector<int> u = get_pairwise_xor(b); map<int, int> mv, mu; set<int> ts; for(int j = 0; j < u.size(); j++){ if(u[j] > 0){ mu[u[j]]++; ts.insert(u[j]); } } for(int j = 0; j < v.size(); j++){ if(v[j] > 0){ mv[v[j]]++; ts.insert(v[j]); } } set<int> s; for(auto x : ts){ if(x == 0) continue; if(mv[x] > mu[x]){ int rv = x^o; pos[rv]+=st; } } } // for(auto x : pos){ // cout << x.first << " " << x.second << endl; // } // cout << endl; vector<int> ans(n); ans[0]=v[1]; for(auto x : pos){ ans[x.second-1]=x.first; } return ans; } // signed main() { // int n; // cin >> n; // vector<int> sol = guess(n); // // for(auto x : sol) cout << x << endl; // }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...