結果

問題 No.2895 Zero XOR Subset
ユーザー karinohitokarinohito
提出日時 2024-09-20 22:51:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 967 bytes
コンパイル時間 2,810 ms
コンパイル使用メモリ 219,160 KB
実行使用メモリ 15,872 KB
最終ジャッジ日時 2024-09-20 22:51:47
合計ジャッジ時間 5,834 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 62 ms
15,780 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 62 ms
15,752 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 61 ms
15,860 KB
testcase_09 AC 3 ms
5,376 KB
testcase_10 AC 3 ms
5,376 KB
testcase_11 AC 3 ms
5,376 KB
testcase_12 AC 63 ms
15,756 KB
testcase_13 AC 3 ms
5,376 KB
testcase_14 AC 3 ms
5,376 KB
testcase_15 AC 66 ms
15,848 KB
testcase_16 AC 3 ms
5,376 KB
testcase_17 AC 3 ms
5,376 KB
testcase_18 AC 66 ms
15,792 KB
testcase_19 AC 3 ms
5,376 KB
testcase_20 AC 3 ms
5,376 KB
testcase_21 AC 3 ms
5,376 KB
testcase_22 AC 3 ms
5,376 KB
testcase_23 AC 3 ms
5,376 KB
testcase_24 AC 3 ms
5,376 KB
testcase_25 AC 3 ms
5,376 KB
testcase_26 AC 65 ms
15,788 KB
testcase_27 AC 3 ms
5,376 KB
testcase_28 AC 3 ms
5,376 KB
testcase_29 AC 66 ms
15,856 KB
testcase_30 AC 3 ms
5,376 KB
testcase_31 AC 3 ms
5,376 KB
testcase_32 AC 64 ms
15,796 KB
testcase_33 AC 3 ms
5,376 KB
testcase_34 AC 69 ms
15,744 KB
testcase_35 AC 3 ms
5,376 KB
testcase_36 AC 63 ms
15,872 KB
権限があれば一括ダウンロードができます

ソースコード

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<map<ll,ll>> P(N);
    for(int i=0;i<N;i++){
        P[i][i]=1;
        for(int j=0;j<i;j++){
            if((A[j].first^A[i].first)<A[i].first){
                A[i].first=(A[j].first^A[i].first);
                for(auto m:P[j]){
                    if(m.second==1)P[i][m.first]=1-P[i][m.first];
                }
            }
        }
        if(A[i].first==0){
            vector<ll> AN;
            for(auto m:P[i])if(m.second==1)AN.push_back(A[m.first].second+1);
            int an=AN.size();
            cout<<an<<endl;
            for(int j=0;j<an;j++)cout<<AN[j]<<" \n"[j==an-1];
            return 0;
        }

    }
    cout<<-1<<endl;
}
0