#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <interactive.h>
using namespace std;
#define f first
#define s second
#define pb push_back
#define all(a) a.begin(),a.end()
typedef long long ll;
typedef long double ld;
typedef pair <int,int> pii;
typedef pair <ll,ll> pll;
typedef vector <ll> vl;
typedef vector <int> vi;
typedef vector <bool> vb;
typedef vector <vector <int> > vvi;
typedef vector <vector <ll> > vvl;
typedef vector <pair<int,int> > vii;
typedef vector <pair<ll,ll> > vll;
string itos(int n) {stringstream ss;ss<<n;string s=ss.str();return s;}
vi guess(int n) {
vi ans(n);
ans[0]=ask(1);
map<int,int> check;
for (int ind=0;ind<7;++ind) {
vi cur;
for (int i=2;i<=n;++i) {
if (i&(1<<ind)) {
cur.pb(i);
}
}
vi a=get_pairwise_xor(cur);
cur.pb(ans[0]);
vi b=get_pairwise_xor(cur);
map<int,int> cnt;
for (int i : b) {
cnt[i]++;
}
for (int i : a)
cnt[i]--;
for (auto i : cnt) {
if (i.f && i.s) {
check[i.f^ans[0]]|=(1<<ind);
}
}
}
for (auto i : check) {
ans[i.s-1]=i.f;
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
252 KB |
Not correct position |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Not correct position |
2 |
Halted |
0 ms |
0 KB |
- |