이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*
IN THE NAME OF GOD
*/
#include <bits/stdc++.h>
#include "interactive.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef long double ld;
#define F first
#define S second
#define Mp make_pair
#define pb push_back
#define pf push_front
#define size(x) ((ll)x.size())
#define all(x) (x).begin(),(x).end()
#define kill(x) cout << x << '\n', exit(0);
#define fuck(x) cout << "(" << #x << " , " << x << ")" << endl
#define endl '\n'
vector<int> guess(int n) {
vector<int> ans;
if(n <= 15) {
for(int i=1; i<=n; i++) ans.pb(ask(i));
return ans;
}
ans.pb(ask(1));
for(int i=0; i<n-1; i++) ans.pb(0);
vector<int> vec[n+1];
map<int, int> mp[10], mp2[10];
set<int> st;
for(int b=0; b<7; b++) {
for(int i=2; i<=n; i++) {
if((i&(1<<b)) > 0) {
vec[b].pb(i);
}
}
vector<int> tmp[2];
for(auto it : vec[b]) {
tmp[0].pb(it); tmp[1].pb(it);
}
tmp[1].pb(1);
tmp[0] = get_pairwise_xor(tmp[0]);
tmp[1] = get_pairwise_xor(tmp[1]);
for(auto it : tmp[1]) {
mp[b][it] ++;
}
for(auto it : tmp[0]) {
mp[b][it] --;
}
mp[b][0]--;
for(auto it : mp[b]) {
if(it.S == 2) {
mp2[b][it.F^ans[0]] ++;
st.insert(it.F^ans[0]);
}
}
}
for(auto it : st) {
int x = 0;
for(int b=0; b<7; b++) {
if(mp2[b][it] == 1) {
x += (1<<b);
}
}
ans[x - 1] = it;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |