Submission #910939

#TimeUsernameProblemLanguageResultExecution timeMemory
910939daoquanglinh2007Xoractive (IZhO19_xoractive)C++17
0 / 100
2 ms344 KiB
#include <bits/stdc++.h> #include "interactive.h" using namespace std; #define isz(a) (int)(a).size() #define pii pair <int, int> #define fi first #define se second #define mp make_pair map <int, int> cnt[7], tmp; vector <int> comp(vector <int> a, vector <int> b){ vector <int> c(0); int j = 0; for (int i = 0; i < isz(b); i++){ while (j < isz(a) && a[j] < b[i]) c.push_back(a[j++]); j++; } while (j < isz(a)) c.push_back(a[j++]); return c; } bool cmp(int x, int y){ return __builtin_popcount(x) > __builtin_popcount(y); } vector <int> guess(int n){ vector <int> ans(n); ans[0] = ask(1); for (int i = 0; (1<<i) < n; i++){ vector <int> a(0), b(0); for (int j = 1; j < n; j++) if ((j>>i)&1) b.push_back(j+1); a = b; a.push_back(1); vector <int> c = comp(get_pairwise_xor(a), get_pairwise_xor(b)); for (int j = 1; j < isz(c); j += 2) cnt[i][c[j]^ans[0]]++; } vector <int> ord(0); for (int i = 1; i < n; i++) ord.push_back(i); //sort(ord.begin(), ord.end(), cmp); for (int t = 0; t < isz(ord); t++){ int i = ord[t]; for (int j = 0; (1<<j) < n; j++) if ((i>>j)&1){ for (pii P : cnt[j]){ if (P.se == 0) continue; bool ok = 1; for (int k = j+1; (1<<k) < n; k++) if (((i>>k)&1) && cnt[k][P.fi] == 0){ ok = 0; break; } if (ok){ ans[i] = P.fi; for (int k = 0; (1<<k) < n; k++) if ((i>>k)&1){ cnt[k][P.fi]--; } break; } } break; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...