結果

問題 No.351 市松スライドパズル
ユーザー nebukuro09nebukuro09
提出日時 2016-10-28 16:55:36
言語 D
(dmd 2.107.1)
結果
AC  
実行時間 973 ms / 2,000 ms
コード長 699 bytes
コンパイル時間 995 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 201,804 KB
最終ジャッジ日時 2023-09-02 22:34:24
合計ジャッジ時間 14,243 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 904 ms
200,192 KB
testcase_01 AC 2 ms
4,372 KB
testcase_02 AC 1 ms
4,368 KB
testcase_03 AC 2 ms
4,368 KB
testcase_04 AC 2 ms
4,368 KB
testcase_05 AC 1 ms
4,372 KB
testcase_06 AC 1 ms
4,372 KB
testcase_07 AC 1 ms
4,368 KB
testcase_08 AC 1 ms
4,368 KB
testcase_09 AC 2 ms
4,368 KB
testcase_10 AC 1 ms
4,372 KB
testcase_11 AC 1 ms
4,368 KB
testcase_12 AC 1 ms
4,368 KB
testcase_13 AC 942 ms
199,776 KB
testcase_14 AC 949 ms
200,004 KB
testcase_15 AC 970 ms
200,268 KB
testcase_16 AC 959 ms
200,496 KB
testcase_17 AC 956 ms
200,172 KB
testcase_18 AC 955 ms
201,804 KB
testcase_19 AC 960 ms
201,544 KB
testcase_20 AC 973 ms
200,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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");
}
0