This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#include "interactive.h"
#define ll long long
#define double long double
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod (10*10*10*10*10*10*10*10*10+7)
#define PI 3.14159265359
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005ll
#define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
vector<int>res[105];
int a[105];
set<int>s,ss[105];
map<ll,ll>cnt;
vector<int>ans;
void calc(int pos){
vector<int>x,y;
x=get_pairwise_xor(res[pos]);
res[pos].pb(1);
y=get_pairwise_xor(res[pos]);
cnt.clear();
for(auto it : y){
cnt[it]++;
}
for(auto it : x){
cnt[it]--;
}
for(auto it : cnt){
if(it.f&&it.s){
s.insert((it.f^ans[0]));
ss[pos].insert((it.f^ans[0]));
}
}
}
vector<int> guess(int n){
ans.pb(ask(1));
for(ll i=2;i<=n;i++)
{
for(ll j=0;j<=6;j++)
{
if(i&(1<<j)){
res[j].pb(i);
}
}
}
for(ll i=0;i<7;i++)
{
if(res[i].size()){
calc(i);
}
}
for(auto it : s){
ll pos=0;
for(ll i=0;i<7;i++)
{
if(ss[i].find(it)!=ss[i].end()){
pos^=(1<<i);
}
}
a[pos]=it;
}
for(ll i=2;i<=n;i++)
{
ans.pb(a[i]);
}
return ans;
}
/*
int32_t main(){
CODE_START;
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |