complete 18937.cpp 24518.cpp

This commit is contained in:
2026-03-19 02:50:57 +09:00
parent 7f6e7da73f
commit 7768f8b446
2 changed files with 68 additions and 17 deletions

View File

@@ -0,0 +1,52 @@
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <string>
#define let auto
#define fn auto
using namespace std;
typedef size_t usize;
typedef uint64_t u64;
const let WHITE_KING = "Whiteking";
const let BLACK_KING = "Blackking";
fn fastio() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
}
fn main() -> int {
usize n;// count of logs
cin >> n;
let arr = new u64[n];// length of each log
for (usize i = 0; i < n; i++) {
cin >> arr[i];
}
string who;
cin >> who;
let first = (who[0] == 'W') ? false : true;
let g = 0;
for (usize i = 0; i < n; i++) {
let e = arr[i] - 2;
g ^= e;
}
//
// W0B WOOOB
if (g == 0) {
cout << (first ? WHITE_KING : BLACK_KING);
} else {
cout << (!first ? WHITE_KING : BLACK_KING);
}
// free
delete[] arr;
return 0;
}