https://www.luogu.com.cn/problem/P1247
#include <bits/stdc++.h> using namespace std; #define int long long const int maxn = 5e5 + 5; int n; int a[maxn]; signed main(){ //freopen("in","r",stdin); ios::sync_with_stdio(0); cin >> n; int tmp = 0; for(int i = 1; i <= n; i++){ cin >> a[i]; tmp ^= a[i]; } if(tmp){ for(int i = 1; i <= n; i++){ if((a[i] ^ tmp) >= a[i]) continue; cout << a[i] - (a[i] ^ tmp) << " " << i << endl; a[i] ^= tmp; break; } for(int i = 1; i <= n; i++) cout << a[i] << " "; }else cout << "lose\n"; return 0; }
原文地址:https://www.cnblogs.com/xcfxcf/p/12425613.html
时间: 2024-11-14 19:13:55