#include <bits/stdc++.h>
#include "interactive.h"
#pragma GCC optimize("03")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define pii pair<int,int>
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define mem(a,i) memset(a,i,sizeof(a))
#define sz(s) (int)s.size()
#define y1 yy
#define ppb pop_back
#define lb lower_bound
#define ub upper_bound
#define gcd(a,b) __gcd(a,b)
#define in insert
const int MAX=3e5+15;
const int B=2e5;
const int N=104;
const int block=450;
const int maxB=MAX/B+10;
const ll inf=1e18;
const int mod=1e9+7;
const int mod1=1e9+9;
const ld eps=1e-9;
int dx[8]={1,0,-1,0,1,-1,-1,1};
int dy[8]={0,1,0,-1,1,-1,1,-1};
int a[MAX],b[MAX];
map<int,int> mp;
// int ask(int pos){
// return b[pos];
// }
// vector<int> get_pairwise_xor(vector<int> f){
// vector<int> res;
// for(int x:f){
// for(int y:f){
// res.pb(b[x]^b[y]);
// }
// }
// sort(all(res));
// return res;
// }
vector<int> guess(int n){
vector<int> ans;
a[1]=ask(1);
for(int i=0;i<7;i++){
vector<int> ask,ask1;
for(int j=2;j<=n;j++){
if((j>>i)&1){
ask.pb(j);
ask1.pb(j);
}
}
ask1.pb(1);
sort(all(ask1));
vector<int> v=get_pairwise_xor(ask);
vector<int> v1=get_pairwise_xor(ask1);
// for(int pos:ask)cout<<pos<<" ";
// cout<<"\n";
// for(int pos:ask1)cout<<pos<<" ";
// cout<<"\n";
multiset<int> st;
for(int x:v1)st.in(x);
for(int x:v){
st.erase(x);
}
set<int> st1;
for(int x:st)st1.in(x);
for(int x:st1){
// cout<<i<<" "<<(x^a[1])<<"\n";
mp[(x^a[1])]+=(1<<i);
}
}
for(pii x:mp){
a[x.S]=x.F;
}
for(int i=1;i<=n;i++)ans.pb(a[i]);
return ans;
}
// int main(){
// int n;
// cin>>n;
// for(int i=1;i<=n;i++)cin>>b[i];
// vector<int> f=guess(n);
// for(int x:f)cout<<x<<" ";
// }
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
Not correct size |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
2392 KB |
Output is correct |
2 |
Correct |
4 ms |
2392 KB |
Output is correct |
3 |
Incorrect |
3 ms |
2392 KB |
Output is not correct |
4 |
Halted |
0 ms |
0 KB |
- |