mt19937_64 randdev(8901016); inline int rand(int l, int h) { return uniform_int_distribution(l, h)(randdev); } int N,M,A[100010]; int ss[100010],x; int ans[100010],best; { rd(N,M,A(N)); REP(i,M) x ^= A[i], ss[i] = i; REP(_,10){ int j = rand(0,M-1); int k = rand(0,N-1); x ^= A[ss[j]]; x ^= A[k]; ss[j] = k; if (x > best){ best = x; if (_ > N/10){ copy(ss,ss+M,ans); } } } REP(i,M) wtSp(A[ss[i]]); }