結果

問題 No.2672 Subset Xor Sum
ユーザー nononnonon
提出日時 2024-03-15 21:39:27
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 649 bytes
コンパイル時間 1,817 ms
コンパイル使用メモリ 203,248 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-09-30 04:15:23
合計ジャッジ時間 4,602 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 66
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/modint>
using namespace std;
using mint=atcoder::modint998244353;
const int M=8192;
int N,A[5<<17];
mint dp[M],ep[M];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>N;
    int X=0;
    for(int i=0;i<N;i++)
    {
        cin>>A[i];
        X^=A[i];
    }
    if(X)
    {
        cout<<"No\n";
        return 0;
    }
    if(N>M)
    {
        cout<<"Yes\n";
        return 0;
    }
    dp[0]=1;
    for(int i=0;i<N;i++)
    {
        for(int j=0;j<M;j++)ep[j]=dp[j];
        for(int j=0;j<M;j++)ep[j^A[i]]+=dp[j];
        swap(dp,ep);
    }
    cout<<(dp[0]!=2?"Yes\n":"No\n");
}
0