結果
| 問題 |
No.2672 Subset Xor Sum
|
| コンテスト | |
| ユーザー |
t9unkubj
|
| 提出日時 | 2024-03-15 21:47:20 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 234 ms / 2,000 ms |
| コード長 | 811 bytes |
| コンパイル時間 | 2,194 ms |
| コンパイル使用メモリ | 198,676 KB |
| 最終ジャッジ日時 | 2025-02-20 04:54:09 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 66 |
ソースコード
/**
* author: t9unkubj
* created: 2024-03-15
*/
#include<bits/stdc++.h>
#ifdef t9unkubj
#define _GLIBCXX_DEBUG
#define dbg(x) cout<<__LINE__<<" "<<#x<<":="<<x<<endl;
#else
#define dbg(x) t9unkubj
#endif
using namespace std;
//#include<atcoder/all>
//using namespace atcoder;
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n;
cin>>n;
vector<int>a(n);
for(int i=0;i<n;i++)cin>>a[i];
int res=0;
for(int i=0;i<n;i++)res^=a[i];
if(res){
cout<<"No"<<endl;
return 0;
}
if(n>=5001){
cout<<"Yes"<<endl;
return 0;
}
vector dp(n+1,vector<int>(8200));
dp[0][0]++;
for(int i=0;i<n;i++){
dp[i+1]=dp[i];
for(int j=0;j<8200;j++){
int ret=j^a[i];
if(ret<8200)dp[i+1][ret]+=dp[i][j],dp[i+1][ret]=min(10,dp[i+1][ret]);
}
}
cout<<(dp[n][0]>=3?"Yes":"No")<<endl;
}
t9unkubj