結果

問題 No.2672 Subset Xor Sum
ユーザー harurunharurun
提出日時 2024-03-18 01:36:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,944 bytes
コンパイル時間 8,667 ms
コンパイル使用メモリ 509,756 KB
実行使用メモリ 7,644 KB
最終ジャッジ日時 2024-03-18 01:36:29
合計ジャッジ時間 14,565 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 2 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 3 ms
6,676 KB
testcase_14 AC 2 ms
6,676 KB
testcase_15 AC 2 ms
6,676 KB
testcase_16 AC 2 ms
6,676 KB
testcase_17 AC 2 ms
6,676 KB
testcase_18 AC 2 ms
6,676 KB
testcase_19 AC 2 ms
6,676 KB
testcase_20 AC 2 ms
6,676 KB
testcase_21 AC 2 ms
6,676 KB
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 3 ms
6,676 KB
testcase_27 AC 3 ms
6,676 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 193 ms
7,164 KB
testcase_32 AC 78 ms
6,676 KB
testcase_33 AC 66 ms
6,676 KB
testcase_34 AC 162 ms
6,676 KB
testcase_35 AC 187 ms
7,168 KB
testcase_36 AC 157 ms
6,676 KB
testcase_37 AC 181 ms
7,040 KB
testcase_38 AC 92 ms
6,676 KB
testcase_39 AC 208 ms
7,456 KB
testcase_40 AC 37 ms
6,676 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 50 ms
6,676 KB
testcase_47 AC 50 ms
6,676 KB
testcase_48 AC 50 ms
6,676 KB
testcase_49 AC 50 ms
6,676 KB
testcase_50 AC 50 ms
6,676 KB
testcase_51 AC 50 ms
6,676 KB
testcase_52 AC 50 ms
6,676 KB
testcase_53 AC 50 ms
6,676 KB
testcase_54 AC 50 ms
6,676 KB
testcase_55 AC 50 ms
6,676 KB
testcase_56 AC 50 ms
6,676 KB
testcase_57 AC 35 ms
6,676 KB
testcase_58 AC 14 ms
6,676 KB
testcase_59 AC 11 ms
6,676 KB
testcase_60 AC 30 ms
6,676 KB
testcase_61 AC 19 ms
6,676 KB
testcase_62 AC 22 ms
6,676 KB
testcase_63 AC 28 ms
6,676 KB
testcase_64 AC 42 ms
6,676 KB
testcase_65 AC 14 ms
6,676 KB
testcase_66 AC 2 ms
6,676 KB
testcase_67 AC 2 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <iostream>
#include <vector>
#include <algorithm>
#include <deque>
#include <queue>
#include <string>
#include <iomanip>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <utility>
#include <stack>
#include <random>
#include <complex>
#include <functional>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <assert.h>
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
#if __has_include(<boost/multiprecision/cpp_int.hpp>)
#include <boost/multiprecision/cpp_int.hpp>
using cpp_int=boost::multiprecision::cpp_int;
#endif
#if __has_include(<boost/multiprecision/cpp_dec_float.hpp>)
#include <boost/multiprecision/cpp_dec_float.hpp>
template<unsigned size>using cpp_float=boost::multiprecision::number<boost::multiprecision::cpp_dec_float<size>>;
template<unsigned size>using cpp_double=boost::multiprecision::number<boost::multiprecision::cpp_dec_float<size,long long>>;
#endif
using namespace std;
using ll=long long;
#define read(x) cin>>(x);
#define readll(x) ll (x);cin>>(x);
#define readS(x) string (x);cin>>(x);
#define readvll(x,N) vector<ll> (x)((N));for(int i=0;i<(N);i++){cin>>(x)[i];}
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define rep2d(i,j,H,W) for(ll (i)=0;(i)<(H);(i)++)for(ll (j)=0;(j)<(W);j++)
#define is_in(x,y) (0<=(x) && (x)<H && 0<=(y) && (y)<W)
#define yn {cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define double_out(x) fixed << setprecision(x)
template<class T> inline void erase_duplicate(vector<T>& A){sort(A.begin(),A.end());A.erase(unique(A.begin(),A.end()),A.end());}
inline ll powll(ll x,ll n){ll r=1;while(n>0){if(n&1){r*=x;};x*=x;n>>=1;};return r;}


int main(){
  ll N;
  cin>>N;
  vector<ll> A(N);
  ll c=8192,S=0;
  for(ll i=0;i<N;i++){
    cin>>A[i];
    S^=A[i];
  }
  if(N>=5001){
    map<ll,ll> mp;
    for(ll i=0;i<N;i++){
      if(mp.find(A[i])==mp.end()){
        mp[A[i]]=1;
      }else{
        mp[A[i]]++;
      }
    }
    ll T=0;
    vector<ll> B;
    for(pair<ll,ll> i:mp){
      if(i.second>1){
        T+=i.second/2;
      }else{
        B.push_back(i.first);
      }
    }
    if(T>=2){
      cout<<"Yes"<<endl;
    }else{
      vector<ll> dp(c+1,B.size()+1);
      for(ll i=0;i<B.size();i++){
        vector<ll> dp2=dp;
        dp2[B[i]]=1;
        for(ll j=0;j<c;j++){
          dp2[B[i]^j]=min(dp[B[i]^j],dp[j]+1);
        }
        swap(dp,dp2);
      }
      if(dp[0]<=B.size()){
        cout<<"Yes"<<endl;
      }else{
        cout<<"No"<<endl;
      }
    }
  }else{
    vector<ll> dp(c+1,N+1);
    for(ll i=0;i<N;i++){
      vector<ll> dp2=dp;
      dp2[A[i]]=1;
      for(ll j=0;j<c;j++){
        dp2[A[i]^j]=min(dp2[A[i]^j],dp[j]+1);
      }
      swap(dp2,dp);
    }
    if(dp[0]<N && S==0){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
  }
}
0