結果
問題 | No.2672 Subset Xor Sum |
ユーザー |
![]() |
提出日時 | 2024-03-15 21:39:27 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 104 ms / 2,000 ms |
コード長 | 649 bytes |
コンパイル時間 | 1,845 ms |
コンパイル使用メモリ | 194,164 KB |
最終ジャッジ日時 | 2025-02-20 04:45:26 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 66 |
ソースコード
#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");}