結果

問題 No.2672 Subset Xor Sum
ユーザー airthsairths
提出日時 2024-03-16 18:03:23
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,572 bytes
コンパイル時間 1,659 ms
コンパイル使用メモリ 156,328 KB
実行使用メモリ 198,912 KB
最終ジャッジ日時 2024-03-16 18:03:29
合計ジャッジ時間 6,046 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 WA -
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 3 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 3 ms
6,676 KB
testcase_11 AC 2 ms
6,676 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 2 ms
6,676 KB
testcase_23 AC 2 ms
6,676 KB
testcase_24 AC 2 ms
6,676 KB
testcase_25 AC 2 ms
6,676 KB
testcase_26 AC 7 ms
9,344 KB
testcase_27 AC 6 ms
9,344 KB
testcase_28 AC 2 ms
6,676 KB
testcase_29 AC 2 ms
6,676 KB
testcase_30 AC 2 ms
6,676 KB
testcase_31 AC 36 ms
6,808 KB
testcase_32 AC 16 ms
6,676 KB
testcase_33 AC 14 ms
6,676 KB
testcase_34 AC 27 ms
6,676 KB
testcase_35 AC 37 ms
6,784 KB
testcase_36 AC 31 ms
6,676 KB
testcase_37 AC 35 ms
6,676 KB
testcase_38 AC 19 ms
6,676 KB
testcase_39 AC 39 ms
7,100 KB
testcase_40 AC 8 ms
6,676 KB
testcase_41 AC 24 ms
6,676 KB
testcase_42 AC 35 ms
6,676 KB
testcase_43 AC 28 ms
6,676 KB
testcase_44 AC 40 ms
7,160 KB
testcase_45 AC 27 ms
6,676 KB
testcase_46 AC 3 ms
6,676 KB
testcase_47 AC 149 ms
198,656 KB
testcase_48 AC 3 ms
6,676 KB
testcase_49 AC 2 ms
6,676 KB
testcase_50 AC 2 ms
6,676 KB
testcase_51 AC 145 ms
198,912 KB
testcase_52 AC 145 ms
198,912 KB
testcase_53 AC 144 ms
198,656 KB
testcase_54 AC 144 ms
198,656 KB
testcase_55 AC 145 ms
198,656 KB
testcase_56 AC 3 ms
6,676 KB
testcase_57 AC 103 ms
138,240 KB
testcase_58 AC 36 ms
49,920 KB
testcase_59 AC 2 ms
6,676 KB
testcase_60 AC 2 ms
6,676 KB
testcase_61 AC 2 ms
6,676 KB
testcase_62 AC 68 ms
86,912 KB
testcase_63 AC 78 ms
105,728 KB
testcase_64 AC 120 ms
163,712 KB
testcase_65 AC 36 ms
50,432 KB
testcase_66 AC 2 ms
6,676 KB
testcase_67 AC 2 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/*
 * 
 * 	^v^
 * 
 */
#include <iostream>
#include <numeric>
#include <set>
#include <iomanip>
#include <chrono>
#include <queue>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <algorithm>
#include <array>
#include <random>

using namespace std;

using ll = long long int;
using ld = long double;

#define iamtefu ios_base::sync_with_stdio(false); cin.tie(0);
#define fl(i,a,n) for (ll i(a); i<n; i++)
#define rfl(i,a,n) for (ll i(n-1); i>=a; i--)
#define ty int _; for(cin>>_; _--;)
#define print(a) for(auto ele:a){cout<<ele<<" ";}cout<<'\n';

template <typename L, typename R>
inline bool chmax(L &a, R &b){if (a<b){a=b;return 1;}return 0;}
template <typename L, typename R>
inline bool chmin(L &a, R &b){if (a>b){a=b;return 1;}return 0;}

template <typename L, typename R>
ostream& operator<<(ostream &fout, pair<L, R> &p){
	fout<<"{"<<p.first<<","<<p.second<<"}";
	return fout;
}

template <typename T>
ostream& operator<<(ostream &fout, vector <T> &v){
	for (auto &x:v){
		fout<<x<<" ";
	}
	fout<<"\n";
	return fout;
}

template <typename T>
ostream& operator<<(ostream &fout, set <T> &st){
	for (auto &x:st){
		fout<<x<<" ";
	}
	fout<<"\n";
	return fout;
}

template <typename K, typename V>
ostream& operator<<(ostream &fout, map<K, V> &mp){
	fout<<"[";
	for (auto &[x,y]:mp){
		fout<<x<<":"<<y<<" ";
	}
	fout<<"]\n";
	return fout;
}

ll gcd(ll a, ll b){
	if (b==0){
		return a;
	}
	return gcd(b, a%b);
}

mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

ll pw(ll a, ll b, ll m){
	ll res=1;
	a%=m;
	while (b){
		if (b&1){
			res=(res*a)%m;
		}
		a=(a*a)%m;
		b/=2;
	}
	return res;
}

void scn(){
	ll n; cin>>n;
	vector <ll> a(n);
	ll xr = 0;
	fl(i,0,n){
		cin>>a[i];
		xr^=a[i];
	}
	if (xr){
		cout<<"No\n";
		return;
	} else {
		if (n>5000){
			cout<<"Yes\n";
			return;
		} else {
			vector <vector <ll>> dp(n+1, vector <ll>(5001));
			fl(i,1,n){
				dp[i][a[i-1]]|=1;
				fl(j,1,5001){
					dp[i][j]|=dp[i-1][j];
					dp[i][a[i-1]^j]|=dp[i-1][j];
				}
				if (dp[i][0]){
					cout<<"Yes\n";
					return;
				}
			}
			cout<<"No\n";
		}
	}

	// not necessarily distinct
	// right down
}

int main(){
	iamtefu;
#if defined(airths)
	auto t1=chrono::high_resolution_clock::now();
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	// ty
	{
		scn();
	}
#if defined(airths)
	auto t2=chrono::high_resolution_clock::now();
	ld ti=chrono::duration_cast<chrono::nanoseconds>(t2-t1).count();
	ti*=1e-6;
	cerr<<"Time: "<<setprecision(12)<<ti;
	cerr<<"ms\n";
#endif
	return 0;
}
0