# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
527821 | 2022-02-18T12:52:34 Z | definitelynotmee | Xoractive (IZhO19_xoractive) | C++17 | 2 ms | 544 KB |
#include<bits/stdc++.h> #define mp make_pair #define mt make_tuple #define all(x) x.begin(), x.end() #define ff first #define ss second using namespace std; template <typename T> using matrix = vector<vector<T>>; typedef unsigned int uint; typedef unsigned long long ull; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; const ll INFL = (1LL<<62)-1; const int INF = (1<<30)-1; const double EPS = 1e-7; const int MOD = 1e9 + 7; const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count(); const int MAXN = 1e6+1; #include "interactive.h" /*vector<int> arr; int ask(int i){ cout << "ask " << i << endl; int in; cin >> in; return in; } vector<int> get_pairwise_xor(vector<int> q){ /*cout << "get_pairwise_xor "; for(int i : q) cout << i << ' '; cout << endl; vector<int> ret; for(int i = 0; i < q.size(); i++){ for(int j = i; j < q.size(); j++){ ret.push_back(arr[q[i]-1]^arr[q[j]-1]); } } sort(all(ret)); return ret; }*/ vector<int> guess(int n) { int last = ask(n); auto getset =[&](vector<int>& q)->vector<int>{ q.push_back(n); vector<int> tot = get_pairwise_xor(q); q.pop_back(); vector<int> totminus = get_pairwise_xor(q); vector<int> v(q.size()); int p1 = 0, p2 = 0; int ptr = 0; while(p1 < tot.size()){ if(p2 == totminus.size() || totminus[p2] != tot[p1]){ if(tot[p1] != 0){ v[ptr] = tot[p1]^last; ptr++; } } else p2++; p1++; } /*cout << "getset "; for(int i : q) cout << i << ' '; cout << "\n-> "; for(int i : v) cout << i << ' '; cout << endl;*/ return v; }; vector<int> q(n-1); iota(all(q),1); matrix<int> group = {getset(q)}; int limit = 0; while(group.size() < n-1 && limit < 5){ matrix<int> newgroup; vector<int> q; int ct = 1; for(vector<int>& i : group){ for(int j = 0; j < (i.size()+1)/2; j++) q.push_back(ct), ct++; ct+=i.size()-(i.size()+1)/2; } vector<int> r = getset(q); set<int> s(all(r)); for(vector<int>& i : group){ vector<int> g1, g2; for(int j : i){ if(s.count(j)) g1.push_back(j); else g2.push_back(j); } if(g1.size()) newgroup.push_back(g1); if(g2.size()) newgroup.push_back(g2); } swap(group,newgroup); limit++; } vector<int> resp; for(int i = 0 ; i < group.size(); i++){ /*cout << i << ":\n"; for(int j : group[i]) cout << j << ' '; cout << '\n';*/ resp.push_back(group[i].back()); } resp.push_back(last); return resp; } /* int main(){ int n; cin >> n; arr = vector<int>(n); for(int i = 0; i < n; i++){ cin >> arr[i]; } vector<int> resp = guess(n); cout << "! "; for(int i : resp) cout << i << ' '; cout << '\n'; } */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 200 KB | Output is not correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 544 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |