| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 169604 | apostoldaniel854 | Xoractive (IZhO19_xoractive) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <interactive.h>
using namespace std;
vector <int> a;
int n;
typedef long long ll;
#define pb push_back
#define dbg(x) cerr << #x << " " << x << "\n"
vector <int> guess (int n) {
int lst = ask (n);
dbg (n);
map <int, int> nr;
for (int bit = 0; bit < 7; bit++) {
vector <int> q;
for (int i = 1; i < n; i++) {
if (i & (1 << bit))
q.pb (i);
}
auto x = get_pairwise_xor (q);
q.pb (n);
auto y = get_pairwise_xor (q);
map <int, int> mp;
for (auto it : x)
mp[it]--;
for (auto it : y)
mp[it]++;
for (auto it : mp)
if (it.first && it.second)
nr[it.first ^ lst] |= (1 << bit);
}
vector <int> ans (n);
for (auto it : nr)
ans[it.second - 1] = it.first;
ans[n - 1] = lst;
return ans;
}
int main() {
cin >> n;
for (int i = 0; i < n; i++)
cin >> x, a.pb (x);
auto ans = guess (n);
for (auto it : ans)
cout << it << "\n";
return 0;
}
