結果
問題 |
No.2895 Zero XOR Subset
|
ユーザー |
|
提出日時 | 2024-09-20 21:46:17 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 535 bytes |
コンパイル時間 | 1,767 ms |
コンパイル使用メモリ | 167,124 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-20 21:46:25 |
合計ジャッジ時間 | 6,622 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 14 WA * 21 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> P; #define REP(i,n) for(int i=0;i<int(n);i++) ll a[200010]; int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); ll i,j,k; ll N; cin >> N; ll x=0,p=-1; for(i=1;i<=N;i++){ cin >> a[i]; x^=a[i]; if(x==0){ p=i; } } if(p==-1) cout << -1 << endl; else{ cout << p << endl; for(i=1;i<=p;i++) cout << a[i] << ' '; cout << endl; } return 0; }