//雪花飄飄北風嘯嘯
//天地一片蒼茫
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl
#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
//change less to less_equal for non distinct pbds, but erase will bug
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
const int n=8;
int arr[2*n];
multiset<int> s;
bool can(int i){
rep(x,0,n) if (!s.count(arr[x]^i)) return false;
return true;
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin.exceptions(ios::badbit | ios::failbit);
rep(x,0,2*n){
do{
arr[x]=rng()%1000;
} while (s.count(arr[x]));
s.insert(arr[x]);
}
s.clear();
rep(x,0,n) rep(y,n,2*n) s.insert(arr[x]^arr[y]);
rep(x,0,2*n) cout<<arr[x]<<" "; cout<<endl<<endl;
rep(x,0,32){
if (can(x)) cout<<x<<endl;
}
}
Compilation message
Xoractive.cpp: In function 'int main()':
Xoractive.cpp:19:26: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
19 | #define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
| ^~~
Xoractive.cpp:54:2: note: in expansion of macro 'rep'
54 | rep(x,0,2*n) cout<<arr[x]<<" "; cout<<endl<<endl;
| ^~~
Xoractive.cpp:54:34: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
54 | rep(x,0,2*n) cout<<arr[x]<<" "; cout<<endl<<endl;
| ^~~~
/tmp/cc8oxMiw.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccKlyAFm.o:Xoractive.cpp:(.text.startup+0x0): first defined here
/tmp/cc8oxMiw.o: In function `main':
grader.cpp:(.text.startup+0x14c): undefined reference to `guess(int)'
collect2: error: ld returned 1 exit status