結果

問題 No.2658 L-R Nim
ユーザー SnowBeenDidingSnowBeenDiding
提出日時 2024-03-01 23:09:22
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,108 bytes
コンパイル時間 6,050 ms
コンパイル使用メモリ 314,360 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-01 23:10:05
合計ジャッジ時間 34,060 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 6,130 ms
6,676 KB
testcase_02 AC 6,127 ms
6,676 KB
testcase_03 AC 6,095 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 481 ms
6,676 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
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 #

#include <bits/stdc++.h>

#include <atcoder/all>
#define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
using namespace std;
using namespace atcoder;

typedef long long ll;

int f(vector<int> a) {
    int n = a.size();
    unordered_map<int, int> ma;
    int x = 0;
    ma[0]++;
    rep(i, 0, n) {
        x ^= a[i];
        ma[x]++;
    }
    x = 0;
    int ct = 0;
    rep(i, 0, n) {
        ma[x]--;
        ct += ma[x];
        x ^= a[i];
    }
    return ct;
}

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, 0, n) cin >> a[i];
    if (f(a) == 0) {
        cout << "Yes" << endl;
        return 0;
    }
    rep(i, 0, n) {
        a[i]++;
        if (f(a) == 0) {
            cout << "Yes" << endl;
            return 0;
        }
        a[i]--;
    }
    while (clock() < 6000000) {
        int ind = rand() % n;
        int ad = rand() % k + 1;
        if (rand() % 2) ad *= -1;
        a[ind] += ad;
        if (a[ind] > 0 && f(a) == 0) {
            cout << "Yes" << endl;
            return 0;
        }
        a[ind] -= ad;
    }
    cout << "No" << endl;
}
0