結果

問題 No.351 市松スライドパズル
ユーザー rabimea
提出日時 2025-10-01 12:53:03
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 178 ms / 2,000 ms
コード長 764 bytes
コンパイル時間 2,974 ms
コンパイル使用メモリ 276,020 KB
実行使用メモリ 34,816 KB
最終ジャッジ日時 2025-10-01 12:53:11
合計ジャッジ時間 7,664 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

// #pragma GCC optimize ("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target ("avx,avx2,fma")
#include <bits/stdc++.h>

using std::cin, std::cout, std::cerr;
using ll = long long;

int main() {
    std::ios::sync_with_stdio(false);
    int n, m; cin >> n >> m;
    int x = 0, y = 0;
    int q; cin >> q;
    std::function<void(void)> solve = [&]() {
        if(q == 0) return;
        char c; int k; cin >> c >> k;
        q --;
        solve();

        if(c == 'R' && k == x) {
            y --;
            if(y == -1) y = m - 1;
        }
        if(c == 'C' && k == y) {
            x --;
            if(x == -1) x = n - 1;
        }
    };
    solve();

    if((x + y) & 1)
        cout << "black\n";
    else
        cout << "white\n";
}
0