結果
| 問題 | 
                            No.351 市松スライドパズル
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2018-06-11 18:03:54 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 109 ms / 2,000 ms | 
| コード長 | 1,170 bytes | 
| コンパイル時間 | 1,521 ms | 
| コンパイル使用メモリ | 170,072 KB | 
| 実行使用メモリ | 11,624 KB | 
| 最終ジャッジ日時 | 2024-06-30 13:39:16 | 
| 合計ジャッジ時間 | 4,069 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 17 | 
ソースコード
#include "bits/stdc++.h"
using namespace std;
#define fastcin {\
    cin.tie(0);\
    ios::sync_with_stdio(false);\
}
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, a, b) for(int i = a; i >= b; i--)
#define fore(i, a) for(auto &i:a)
#define print(x) cout << x << "\n"
#define SORT(a, n) sort(a, a+n);
#define REVERSE(a,n) reverse(a,a+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VREVERSE(v) reverse(v.begin(), v.end());
#define MOD 1000000007
#define yes "YES"
#define no "NO"
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
int h, w, n;
int main() {
    fastcin;
    cin >> h >> w >> n;
    char s;
    int k, x = 0, y = 0;
    vector<pair<char, int> > vp;
    rep(i, 0, n) {
        cin >> s >> k;
        vp.push_back(make_pair(s, k));
    }
    rrep(i, n-1, 0) {
        s = vp[i].first;
        k = vp[i].second;
        if(s=='R' && k==y) {
            x--;
            if(x<0) x = w-1;
        } else if(s=='C' && k==x) {
            y--;
            if(y<0) y = h-1;
        }
    }
    string ans = "white";
    if((x+y)%2) ans = "black";
    printf("%s\n", ans.c_str());
    return 0;
}