結果
問題 | No.2672 Subset Xor Sum |
ユーザー |
|
提出日時 | 2024-08-02 16:42:05 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 39 ms / 2,000 ms |
コード長 | 1,030 bytes |
コンパイル時間 | 10,165 ms |
コンパイル使用メモリ | 279,192 KB |
最終ジャッジ日時 | 2025-02-23 19:47:04 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 66 |
ソースコード
#pragma GCC optimize("O3")#pragma GCC optimize("Ofast")#pragma GCC optimize("unroll-loops")#pragma GCC target("avx,avx2")#include <bits/stdc++.h>#define INF 1000000001LL#define LNF 1000000000000000001LL#define MOD 1000000007LL#define MAX 200000#define long long long#define all(x) x.begin(),x.end()using namespace std;bool dp[5000][1<<13];int main(){ios_base::sync_with_stdio(0);cin.tie(0);int n;cin >> n;vector<int> arr(n);int al = 0;for(int i = 0; i<n; i++){cin >> arr[i];al^=arr[i];}if(al){cout << "No\n";return 0;}if(n > 15){cout << "Yes\n";return 0;}dp[0][arr[0]] = true;for(int i = 1; i<n-1; i++){for(int j = 0; j<(1<<13); j++){dp[i][j] |= dp[i-1][j];dp[i][j^arr[i]]|=dp[i-1][j];}dp[i][arr[i]] = true;}if(dp[n-2][0])cout << "Yes\n";elsecout << "No\n";return 0;}