結果

問題 No.2895 Zero XOR Subset
ユーザー erbowlerbowl
提出日時 2024-09-21 06:50:56
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,143 bytes
コンパイル時間 3,581 ms
コンパイル使用メモリ 261,648 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-21 06:51:08
合計ジャッジ時間 10,704 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 WA -
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 3 ms
6,940 KB
testcase_06 WA -
testcase_07 AC 2 ms
6,940 KB
testcase_08 WA -
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 2 ms
6,944 KB
testcase_15 WA -
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 2 ms
6,940 KB
testcase_18 WA -
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 2 ms
6,944 KB
testcase_22 WA -
testcase_23 AC 2 ms
6,944 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 AC 2 ms
6,940 KB
testcase_26 WA -
testcase_27 AC 2 ms
6,944 KB
testcase_28 AC 2 ms
6,940 KB
testcase_29 WA -
testcase_30 AC 2 ms
6,944 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 2 ms
6,940 KB
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

typedef long long ll;
typedef long double ld;

#include <bits/stdc++.h>
using namespace std;

signed main(){
    ll n;
    std::cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }
    set<ll> s;
    map<ll,ll> vals;
    map<ll,ll> inds;
    n = min(60ll,n);
    for (int i = 0; i < n; i++) {
        ll index = (1ll<<i);
        ll val = a[i];
        for (auto e : s) {
            if(val>(vals[e]^val)){
                val ^= vals[e];
                index ^= inds[e];
            }
        }
        // std::cout << index<<" "<<val << std::endl;
        if(val!=0){
            s.insert(i);
            vals[i] = val;
            inds[i] = index;
        }else{
            vector<ll> ans;
            for (int i = 0; i < n; i++) {
                if(index&(1ll<<i)){
                    ans.push_back(i);
                }
            }
            std::cout << ans.size() << std::endl;
            for (auto e : ans) {
                std::cout << e+1<<" ";
            }
            std::cout << std::endl;
            return 0;
        }
        
    }
    std::cout << -1 << std::endl;
};
0