結果

問題 No.2658 L-R Nim
ユーザー 👑 NachiaNachia
提出日時 2024-03-02 00:02:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 960 bytes
コンパイル時間 738 ms
コンパイル使用メモリ 77,596 KB
実行使用メモリ 14,468 KB
最終ジャッジ日時 2024-03-02 00:03:54
合計ジャッジ時間 36,605 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,392 KB
testcase_01 AC 4 ms
7,392 KB
testcase_02 AC 4 ms
7,392 KB
testcase_03 AC 4 ms
7,392 KB
testcase_04 AC 4 ms
7,392 KB
testcase_05 AC 58 ms
7,456 KB
testcase_06 AC 90 ms
7,456 KB
testcase_07 AC 59 ms
7,456 KB
testcase_08 AC 155 ms
7,456 KB
testcase_09 AC 111 ms
7,456 KB
testcase_10 AC 78 ms
7,456 KB
testcase_11 AC 73 ms
7,456 KB
testcase_12 AC 89 ms
7,456 KB
testcase_13 AC 83 ms
7,456 KB
testcase_14 AC 90 ms
7,456 KB
testcase_15 AC 136 ms
7,456 KB
testcase_16 AC 85 ms
7,456 KB
testcase_17 AC 92 ms
7,456 KB
testcase_18 AC 90 ms
7,456 KB
testcase_19 AC 86 ms
7,456 KB
testcase_20 AC 71 ms
7,456 KB
testcase_21 AC 77 ms
7,456 KB
testcase_22 AC 70 ms
7,456 KB
testcase_23 AC 68 ms
7,456 KB
testcase_24 AC 88 ms
7,456 KB
testcase_25 AC 5,139 ms
7,792 KB
testcase_26 AC 5,589 ms
7,792 KB
testcase_27 AC 4,508 ms
7,792 KB
testcase_28 AC 5,384 ms
7,792 KB
testcase_29 AC 1,902 ms
7,792 KB
testcase_30 AC 1,817 ms
7,792 KB
testcase_31 TLE -
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 #

// N^2

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define repr(i,n) for(int i=(int)(n)-1; i>=0; i--)

int main(){
    int N, K; cin >> N >> K;
    vector<int> A(N); rep(i,N) cin >> A[i];
    vector<int> XOR(N+1);
    rep(i,N) XOR[i+1] = XOR[i] ^ A[i];
    int 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<int> C(1048576);
    for(int i=0; i<=l; i++) for(int j=l+1; j<=N; j++) C[XOR[i]^XOR[j]]++;
    for(int p=l; p<r; p++){
        if(p != l){
            for(int i=0; i<p; i++) C[XOR[i]^XOR[p]]--;
            for(int i=p+1; i<=N; i++) C[XOR[p]^XOR[i]]++;
        }
        for(int d=-min(A[p],K); d<=K; d++){
            int dx = A[p] ^ (A[p] + d);
            if(C[dx] == 0){ cout << "Yes\n"; return 0; }
        }
    }
    cout << "No\n";
    return 0;
}
0