結果
問題 | No.2672 Subset Xor Sum |
ユーザー |
|
提出日時 | 2024-03-15 21:42:24 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 559 bytes |
コンパイル時間 | 1,902 ms |
コンパイル使用メモリ | 196,984 KB |
最終ジャッジ日時 | 2025-02-20 04:47:41 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 48 RE * 18 |
ソースコード
#include<bits/stdc++.h> using namespace std; int N,A[5<<17]; int main(){ cin.tie(nullptr)->sync_with_stdio(false); cin>>N; for(int i=0;i<N;++i)cin>>A[i]; { int cum=0; for(int i=0;i<N;++i)cum^=A[i]; if(cum!=0){ cout<<"No"<<endl; return 0; } } vector<bool>dp(5<<10,0); for(int i=0;i<N-1;++i){ vector<bool>ep=dp; ep[A[i]]=1; for(int j=0;j<=5000;++j){ if(dp[j]){ ep[A[i]^j]=1; } } swap(dp,ep); if(dp[0]){ cout<<"Yes"<<endl; return 0; } } cout<<"No"<<endl; }