結果
| 問題 | 
                            No.351 市松スライドパズル
                             | 
                    
| コンテスト | |
| ユーザー | 
                             vjudge1
                         | 
                    
| 提出日時 | 2025-03-14 21:41:47 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 100 ms / 2,000 ms | 
| コード長 | 802 bytes | 
| コンパイル時間 | 1,482 ms | 
| コンパイル使用メモリ | 161,984 KB | 
| 実行使用メモリ | 12,440 KB | 
| 最終ジャッジ日時 | 2025-03-14 21:41:52 | 
| 合計ジャッジ時間 | 4,359 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 17 | 
ソースコード
#include <bits/stdc++.h>
#define int long long
//#define USE_FREOPEN
//#define MUL_TEST
#define FILENAME "puzzle"
using namespace std;
char op[1000005];
int k[1000005];
void solve() {
	int h,w;
	cin >> h >> w;
	int n;
	cin >> n;
	int r = 0,c = 0;
	for (int i = 1; i <= n; i++) {
		cin >> op[i] >> k[i];
	}
	for (int i = n; i >= 1; i--) {
		if (op[i] == 'R' && r == k[i]) c = (c - 1 + w) % w;
		else if (op[i] == 'C' && c == k[i]) r = (r - 1 + h) % h;
	}
	
	cout << (((r + c) % 2 == 1) ? "black\n" : "white\n");
}
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	#ifdef USE_FREOPEN
		freopen(FILENAME ".in","r",stdin);
		freopen(FILENAME ".out","w",stdout);
	#endif
	int _ = 1;
	#ifdef MUL_TEST
		cin >> _;
	#endif
	while (_--)
		solve();
	_^=_;
	return 0^_^0;
}
            
            
            
        
            
vjudge1