Submission #202396

#TimeUsernameProblemLanguageResultExecution timeMemory
202396klungsXoractive (IZhO19_xoractive)C++14
6 / 100
11 ms504 KiB
#include "interactive.h" #include <bits/stdc++.h> using namespace std; vector <int> ans; vector<int> contains(vector<int> q) { if (q.size() == 0) return {}; vector<int> qf = q; qf.push_back(1); auto res1 = get_pairwise_xor(qf); auto res2 = get_pairwise_xor(q); set<int> gg (res1.begin(), res1.end()); for (auto x : res2) gg.erase(x); gg.erase(ans[1]); auto res = vector<int>(gg.begin(), gg.end()); for (auto &x : res) x ^= ans[1]; return res; } vector<int> guess(int n) { ans.resize(n + 1); ans[1] = ask(1); vector<int> questions[7], answers[7]; vector<int> question_all(n - 1); iota(question_all.begin(), question_all.end(), 2); vector<int> all = contains(question_all); map<int, int> id; for (auto i : all) { id[i] = 0; } for (int i = 2; i <= n; i++) { for (int j = 0; j < 7; j++) if ((1 << j) & i) { questions[j].push_back(i); } } for (int j = 0; j < 7; j++) { answers[j] = contains(questions[j]); for (int x : answers[j]) { id[x] ^= (1 << j); } } for (auto x : id) { ans[x.second] = x.first; } // for (int i = 1; i <= n; i++) { // int num = ask(i); // cnt[num]++; // ans.push_back(num); // // assert(cnt[num] <= 1); // } vector<int> fix_ans(ans.begin() + 1, ans.end()); return fix_ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...