結果
| 問題 |
No.2672 Subset Xor Sum
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-15 21:46:35 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 43 ms / 2,000 ms |
| コード長 | 562 bytes |
| コンパイル時間 | 1,947 ms |
| コンパイル使用メモリ | 198,624 KB |
| 最終ジャッジ日時 | 2025-02-20 04:53:12 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 66 |
ソースコード
#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(10000+1,0);
for(int i=0;i<N-1;++i){
vector<bool>ep=dp;
ep[A[i]]=1;
for(int j=0;j<=10000;++j){
if(dp[j]){
ep[A[i]^j]=1;
}
}
swap(dp,ep);
if(dp[0]){
cout<<"Yes"<<endl;
return 0;
}
}
cout<<"No"<<endl;
}