結果
問題 |
No.2895 Zero XOR Subset
|
ユーザー |
![]() |
提出日時 | 2024-09-18 21:54:43 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,020 bytes |
コンパイル時間 | 718 ms |
コンパイル使用メモリ | 75,520 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-19 21:52:59 |
合計ジャッジ時間 | 5,970 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 WA * 15 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:21:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions] 21 | for(auto [base, ind]: basis){ | ^
ソースコード
#include <iostream> #include <vector> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<long long> a(n); for(int i = 0; i < n; i++){ cin >> a[i]; } vector<pair<long long, long long>> basis; for(int i = 0; i < n; i++){ long long value = a[i]; long long index = (1LL << i); for(auto [base, ind]: basis){ if((value ^ base) < value){ value ^= base; index ^= ind; } } if(value == 0){ vector<int> ans; for(int j = 0; j < 60; j++){ if(index & (1LL << j)){ ans.emplace_back(j + 1); } } cout << ans.size() << endl; for(int b: ans){ cout << b << " "; } cout << endl; return 0; } basis.emplace_back(value, index); } cout << -1 << endl; }