이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "interactive.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> guess(int n) {
vector<int> ans(n);
ans[0] = ask(1);
map<int,int> pos;
for(int i = 0;i<=6;i++){
if((1<<i) > n)break;
vector<int> tmp;
for(int j = 2;j<=n;j++){
if(j & (1<<i))
tmp.push_back(j);
}
vector<int> a = get_pairwise_xor(tmp);
map<int,int> mp;
tmp.push_back(1);
vector<int> b = get_pairwise_xor(tmp);
for(auto u:a){
if(u)
mp[u]--;
}
for(auto u:b){
if(u)
mp[u]++;
}
for(auto u:mp){
if(u.second == 0)continue;
pos[u.first ^ ans[0]] += (1<<i);
}
}
for(auto u:pos){
ans[u.second-1] = u.first;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |