結果
| 問題 | 
                            No.351 市松スライドパズル
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2016-03-11 23:53:06 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 838 ms / 2,000 ms | 
| コード長 | 1,289 bytes | 
| コンパイル時間 | 2,281 ms | 
| コンパイル使用メモリ | 78,652 KB | 
| 実行使用メモリ | 140,980 KB | 
| 最終ジャッジ日時 | 2024-09-25 02:38:09 | 
| 合計ジャッジ時間 | 12,298 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 17 | 
ソースコード
// JavaでTLE叩き出して恥ずかしい。
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class Main {
	public static void main(String[] args) throws Exception {
		try (InputStreamReader isr = new InputStreamReader(System.in); //
				BufferedReader br = new BufferedReader(isr)) {
			String line = br.readLine();
			String[] ary = line.split(" ");
			int h = Integer.parseInt(ary[0]);
			int w = Integer.parseInt(ary[1]);
			// System.err.println(String.format("h:%d w:%d", h, w));
			int n = Integer.parseInt(br.readLine());
			// System.err.println(String.format("n:%d", n));
			List<String> list = new ArrayList<>();
			for (int i = 0; i < n; i++) {
				list.add(br.readLine());
			}
			int x = 0;
			int y = 0;
			for (int i = list.size() - 1; i >= 0; i--) {
				String sk = list.get(i);
				ary = sk.split(" ");
				String s = ary[0];
				int k = Integer.parseInt(ary[1]);
				if ("R".equals(s) && k == y) {
					x--;
					if (x < 0)
						x = w - 1;
				} else if ("C".equals(s) && k == x) {
					y--;
					if (y < 0)
						y = h - 1;
				}
				// System.err.println(String.format("%s %d (%d, %d)", s, k, x,
				// y));
			}
			System.out.println((x + y) % 2 == 0 ? "white" : "black");
		}
	}
}