結果
| 問題 |
No.2658 L-R Nim
|
| コンテスト | |
| ユーザー |
SnowBeenDiding
|
| 提出日時 | 2024-03-01 23:07:35 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 959 bytes |
| コンパイル時間 | 5,518 ms |
| コンパイル使用メモリ | 315,032 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-09-29 15:01:50 |
| 合計ジャッジ時間 | 292,214 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 33 WA * 15 |
ソースコード
#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;
}
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;
}
SnowBeenDiding