結果

問題 No.2658 L-R Nim
ユーザー 👑 NachiaNachia
提出日時 2024-01-27 17:21:45
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,038 bytes
コンパイル時間 672 ms
コンパイル使用メモリ 77,852 KB
実行使用メモリ 19,056 KB
最終ジャッジ日時 2024-02-29 02:32:58
合計ジャッジ時間 12,777 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
18,928 KB
testcase_01 AC 7 ms
18,928 KB
testcase_02 AC 7 ms
18,928 KB
testcase_03 AC 7 ms
18,928 KB
testcase_04 AC 8 ms
18,928 KB
testcase_05 AC 143 ms
19,056 KB
testcase_06 AC 102 ms
19,056 KB
testcase_07 AC 51 ms
19,056 KB
testcase_08 AC 254 ms
19,056 KB
testcase_09 AC 135 ms
19,056 KB
testcase_10 AC 80 ms
19,056 KB
testcase_11 AC 109 ms
19,056 KB
testcase_12 AC 94 ms
19,056 KB
testcase_13 AC 86 ms
19,056 KB
testcase_14 AC 99 ms
19,056 KB
testcase_15 AC 191 ms
19,056 KB
testcase_16 AC 93 ms
19,056 KB
testcase_17 AC 103 ms
19,056 KB
testcase_18 AC 104 ms
19,056 KB
testcase_19 AC 89 ms
19,056 KB
testcase_20 AC 117 ms
19,056 KB
testcase_21 AC 77 ms
19,056 KB
testcase_22 AC 64 ms
19,056 KB
testcase_23 AC 73 ms
19,056 KB
testcase_24 AC 123 ms
19,056 KB
testcase_25 TLE -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

// 00:19:18
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
#define rep(i,n) for(i64 i=0; i<(i64)(n); i++)
#define repr(i,n) for(i64 i=(i64)(n)-1; i>=0; i--)

int main(){
    i64 N, K; cin >> N >> K;
    vector<i64> A(N); rep(i,N) cin >> A[i];
    vector<i64> XOR(N+1);
    rep(i,N) XOR[i+1] = XOR[i] ^ A[i];
    i64 l = 0, r = N;
    rep(i,N+1) rep(j,i) if(XOR[i] == XOR[j]){
        l = max(l, j);
        r = min(r, i);
    }
    vector<i64> C(2001001);
    bool ok = false;
    for(i64 i=0; i<=l; i++) for(i64 j=l+1; j<=N; j++) C[XOR[i]^XOR[j]]++;
    for(i64 p=l; p<r; p++){
        if(p != l){
            for(i64 i=0; i<p; i++) C[XOR[i]^XOR[p]]--;
            for(i64 i=p+1; i<=N; i++) C[XOR[p]^XOR[i]]++;
        }
        for(i64 d=-min(A[p],K); d<=K; d++){
            i64 dx = A[p] ^ (A[p] + d);
            if(C[dx] == 0) ok = true;
        }
    }
    cout << (ok ? "Yes\n" : "No\n");
    return 0;
}
0