Submission #367391

#TimeUsernameProblemLanguageResultExecution timeMemory
367391fishy15Xoractive (IZhO19_xoractive)C++14
0 / 100
150 ms620 KiB
#include <iostream> #include <iomanip> #include <fstream> #include <vector> #include <array> #include <algorithm> #include <utility> #include <map> #include <queue> #include <set> #include <cmath> #include <cstdio> #include <cstring> #include "interactive.h" #define ll long long #define ld long double #define eps 1e-8 #define MOD 1000000007 #define INF 0x3f3f3f3f #define INFLL 0x3f3f3f3f3f3f3f3f // change if necessary #define MAXN 1000000 using namespace std; vector<int> guess(int n) { int zero = ask(1); vector<vector<vector<int>>> vals(7, vector<vector<int>>(2)); for (int i = 1; i < n; i++) { for (int j = 0; j < 7; j++) { vals[j][(i >> j) & 1].push_back(i + 1); } } for (int i = 0; i < 7; i++) { for (int j = 0; j <= 1; j++) { if (!vals[i][j].empty()) { vals[i][j].push_back(1); auto v = get_pairwise_xor(vals[i][j]); sort(v.begin(), v.end()); v.erase(v.begin(), upper_bound(v.begin(), v.end(), 0)); vals[i][j] = v; } } } vector<int> ans(n); ans[0] = zero; for (int i = 1; i < n; i++) { map<int, int> cnt; for (int j = 0; j < 7; j++) { for (int x : vals[j][(i >> j) & 1]) { cnt[x ^ zero]++; } } pair<int, int> m; for (auto p : cnt) { m = max(m, {p.second, p.first}); } ans[i] = m.second; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...