結果
問題 |
No.2895 Zero XOR Subset
|
ユーザー |
|
提出日時 | 2024-09-20 21:36:17 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 610 bytes |
コンパイル時間 | 1,849 ms |
コンパイル使用メモリ | 198,012 KB |
最終ジャッジ日時 | 2025-02-24 09:56:53 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 35 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main () { int N; cin >> N; vector<pair<ll, ll>> bs; for (int i = 0; i < N; i ++) { ll a; cin >> a; ll st = (1ll << i); for (auto& [b, s] : bs) { if ((a ^ b) < a) { a ^= b; st ^= s; } } if (a) { bs.emplace_back(a, st); } else { vector<int> ans; for (int j = 0; j <= i; j ++) { if ((st >> j) & 1) { ans.push_back(j+1); } } cout << ans.size() << endl; for (auto& p : ans) { cout << p << (p == ans.back() ? "" : " "); } cout << endl; return 0; } } puts("-1"); }