結果

問題 No.1456 Range Xor
ユーザー Izayoi_R_sakuraIzayoi_R_sakura
提出日時 2021-03-31 21:22:35
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 1,485 bytes
コンパイル時間 1,288 ms
コンパイル使用メモリ 133,676 KB
実行使用メモリ 8,180 KB
最終ジャッジ日時 2023-08-21 22:41:11
合計ジャッジ時間 5,235 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 90 ms
8,140 KB
testcase_04 AC 91 ms
8,032 KB
testcase_05 AC 91 ms
8,036 KB
testcase_06 AC 90 ms
8,136 KB
testcase_07 AC 91 ms
8,052 KB
testcase_08 AC 88 ms
8,096 KB
testcase_09 AC 91 ms
8,076 KB
testcase_10 AC 91 ms
8,180 KB
testcase_11 AC 14 ms
4,380 KB
testcase_12 AC 6 ms
4,380 KB
testcase_13 AC 26 ms
5,020 KB
testcase_14 AC 25 ms
5,144 KB
testcase_15 AC 70 ms
7,288 KB
testcase_16 AC 64 ms
6,872 KB
testcase_17 AC 35 ms
5,628 KB
testcase_18 AC 24 ms
4,876 KB
testcase_19 AC 51 ms
6,212 KB
testcase_20 AC 65 ms
6,804 KB
testcase_21 AC 50 ms
6,248 KB
testcase_22 AC 53 ms
6,408 KB
testcase_23 AC 28 ms
5,092 KB
testcase_24 AC 11 ms
4,376 KB
testcase_25 AC 22 ms
4,816 KB
testcase_26 AC 39 ms
5,644 KB
testcase_27 AC 58 ms
6,552 KB
testcase_28 AC 19 ms
4,800 KB
testcase_29 AC 79 ms
7,456 KB
testcase_30 AC 85 ms
7,784 KB
testcase_31 AC 18 ms
4,468 KB
testcase_32 AC 15 ms
4,432 KB
testcase_33 AC 31 ms
5,280 KB
testcase_34 AC 82 ms
7,944 KB
testcase_35 AC 40 ms
5,812 KB
testcase_36 AC 88 ms
8,060 KB
testcase_37 AC 74 ms
7,288 KB
testcase_38 AC 12 ms
4,380 KB
testcase_39 AC 62 ms
6,736 KB
testcase_40 AC 61 ms
6,884 KB
testcase_41 AC 2 ms
4,380 KB
testcase_42 AC 8 ms
4,376 KB
testcase_43 AC 2 ms
4,376 KB
testcase_44 AC 2 ms
4,380 KB
testcase_45 AC 1 ms
4,376 KB
testcase_46 AC 1 ms
4,380 KB
testcase_47 AC 2 ms
4,376 KB
testcase_48 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <functional>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <bitset>
#include <math.h>
#include <random>
#include <chrono>
#include <assert.h>
using namespace std ;
using ll = long long ;
using ld = long double ;
template<class T> using V = vector<T> ;
template<class T> using VV = V<V<T>> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end()
ll mod = 1000000007 ;
long double pie = acos(-1) ;
ll INF = 1e18 ;

void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
ll extGCD(ll a,ll b,ll &x,ll &y){
    if(b==0){
        x = 1 ;
        y = 0 ;
        return a ;
    }
    ll d = extGCD(b,a%b,y,x) ;
    y -= a/b*x ;
    return d ;
}
void fix_cout(){cout << fixed << setprecision(20) ;}
template<class T> void chmax(T &a,T &b){if(a<b) a = b ;}
template<class T> void chmin(T &a,T &b){if(a>b) a = b ;}

int main(){
    int n,k ;
    cin >> n >> k ;
    V<int> a(n) ;
    for(auto &i:a) cin >> i ;
    set<int> s ;
    bool ok = false ;
    int sum = 0 ;
    s.insert(0) ;
    for(int i=0;i<n;i++){
        sum ^= a[i] ;
        ok |= s.count(sum^k) ;
        s.insert(sum) ;
    }
    yorn(ok) ;
}
0