結果

問題 No.2895 Zero XOR Subset
ユーザー karinohitokarinohito
提出日時 2024-09-20 21:35:35
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,001 bytes
コンパイル時間 2,431 ms
コンパイル使用メモリ 211,096 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2024-09-20 21:35:48
合計ジャッジ時間 8,204 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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




int main(){

    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int N;
    cin>>N;
    vector<pair<ll,ll>> A(N);
    for(int i=0;i<N;i++){
        cin>>A[i].first;
        A[i].second=i;
    }
    sort(A.begin(),A.end());

    vector<ll> B;
    for(int i=0;i<N;i++){
        vector<int> ID;
        for(int j=0;j< B.size();j++) {
            if ((A[i].first ^ A[B[j]].first) < A[i].first) {
                A[i].first ^= A[B[j]].first;
                ID.push_back(B[j]);
            }
        }
        for (auto&& b : B) {
            if ((A[i].first ^ A[b].first) < A[b].first)A[b].first ^= A[i].first;
        }
        if (A[i].first > 0) {
            B.push_back(i);
        }
        else{
            ID.push_back(i);
            int an=ID.size();
            cout<<an<<endl;;
            for(int j=0;j<an;j++)cout<<A[ID[j]].second+1<<" \n"[j==an-1];
            return 0;
        }
    }
    cout<<-1<<endl;
}
0