結果
| 問題 | No.351 市松スライドパズル |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-10-28 16:55:36 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 951 ms / 2,000 ms |
| コード長 | 699 bytes |
| 記録 | |
| コンパイル時間 | 858 ms |
| コンパイル使用メモリ | 100,616 KB |
| 実行使用メモリ | 200,524 KB |
| 最終ジャッジ日時 | 2024-06-12 04:46:07 |
| 合計ジャッジ時間 | 13,259 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 |
ソースコード
import std.stdio;
import std.array;
import std.string;
import std.conv;
import std.algorithm;
import std.typecons;
import std.range;
void main() {
auto input = readln().split.map!(to!int);
int H = input[0];
int W = input[1];
int N = readln().chomp.to!int;
string[][] queries = new string[][](N, 2);
foreach (i; iota(N))
queries[i] = readln().split;
int[2] pos;
foreach (i; iota(N-1, -1, -1)) {
int n = queries[i][1].to!int;
if (queries[i][0] == "R" && pos[0] == n)
pos[1] = pos[1] == 0 ? W-1 : pos[1]-1;
if (queries[i][0] == "C" && pos[1] == n)
pos[0] = pos[0] == 0 ? H-1 : pos[0]-1;
}
writeln((pos[0]+pos[1])%2 == 0 ? "white" : "black");
}