Submission #257521

#TimeUsernameProblemLanguageResultExecution timeMemory
257521BTheroXoractive (IZhO19_xoractive)C++17
100 / 100
6 ms512 KiB
// chrono::system_clock::now().time_since_epoch().count() #include<bits/stdc++.h> #include "interactive.h" #define pb push_back #define eb emplace_back #define mp make_pair #define fi first #define se second #define all(x) (x).begin(), (x).end() #define debug(x) cerr << #x << " = " << x << endl; using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<vi> vvi; int n; vi arr; void print(vi x) { fprintf(stderr, "%d:", x.size()); for (int y : x) { fprintf(stderr, " %d", y); } fprintf(stderr, "\n"); } int query(int x) { return ask(x + 1); } vi query(vi x) { for (int &y : x) { ++y; } return get_pairwise_xor(x); } vi guess(int _n) { n = _n; arr = vi(n, 0); arr[0] = query(0); map<int, int> idx; for (int i = 0; (1 << i) < n; ++i) { vi A; for (int j = 1; j < n; ++j) { if ((j >> i) & 1) { A.pb(j); } } vi B = query(A); A.pb(0); vi C = query(A); map<int, int> cnt; for (int x : B) { --cnt[x]; } for (int x : C) { ++cnt[x]; } for (auto it : cnt) { if (it.fi != 0 && it.se > 0) { idx[it.fi ^ arr[0]] += (1 << i); } } } for (auto it : idx) { arr[it.se] = it.fi; } return arr; }

Compilation message (stderr)

Xoractive.cpp: In function 'void print(vi)':
Xoractive.cpp:24:34: warning: format '%d' expects argument of type 'int', but argument 3 has type 'std::vector<int>::size_type {aka long unsigned int}' [-Wformat=]
   fprintf(stderr, "%d:", x.size());
                          ~~~~~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...