結果

問題 No.351 市松スライドパズル
コンテスト
ユーザー t98slider
提出日時 2022-08-26 02:50:31
言語 C++14
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 191 ms / 2,000 ms
+ 439µs
コード長 628 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 915 ms
コンパイル使用メモリ 183,012 KB
実行使用メモリ 11,172 KB
最終ジャッジ日時 2026-09-15 11:44:41
合計ジャッジ時間 6,749 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    int h, w, n;
    cin >> h >> w >> n;
    vector<pair<char,int>> a(n);
    for(int i = 0; i < n; i++)cin >> a[i].first >> a[i].second;
    reverse(a.begin(), a.end());
    int y = 0, x = 0;
    for(int i = 0; i < n; i++){
        if(a[i].first == 'R'){
            if(y == a[i].second){
                x--;
                if(x < 0)x += w;
            }
        }else{
            if(x == a[i].second){
                y--;
                if(y < 0)y += h;
            }
        }
    }
    cout << ((y ^ x) & 1 ? "black" : "white") << '\n';
}
0