結果
問題 | No.2672 Subset Xor Sum |
ユーザー |
![]() |
提出日時 | 2024-03-16 06:35:35 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 161 ms / 2,000 ms |
コード長 | 992 bytes |
コンパイル時間 | 2,581 ms |
コンパイル使用メモリ | 245,164 KB |
実行使用メモリ | 163,456 KB |
最終ジャッジ日時 | 2024-09-30 04:28:16 |
合計ジャッジ時間 | 7,037 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 66 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define rep(i, n) for (int i = 0; i < (int)(n); i++)typedef vector<int> VI;typedef vector<VI> VVI;typedef vector<long long> VL;typedef vector<VL> VVL;typedef long long LL;#define all(a) (a).begin(), (a).end()#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl#define ALL(a) (a).begin(),(a).end()#include <atcoder/modint>using mint = atcoder::modint998244353;int main() {int n;cin>>n;int A[n],a=0;rep(i,n){cin>>A[i];a=a^A[i];}bool h=0;if(a==0){if(n>=5002){h=1;}else{int dp[n][8200]={};dp[0][0]=1;for(int i=1;i<n;i++){rep(j,8200){if(dp[i-1][j]==1){dp[i][j]=1;dp[i][j^A[i]]=1;if((j^A[i])==0){//cout<<j<<' '<<A[i]<<' '<<(j^A[i])<<endl;h=1;break;}}}}//cout<<dp[n-1][0]<<endl;}}Yes(h);}