結果
問題 | No.351 市松スライドパズル |
ユーザー | code-devo |
提出日時 | 2016-03-12 00:27:43 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 572 ms / 2,000 ms |
コード長 | 1,022 bytes |
コンパイル時間 | 3,599 ms |
コンパイル使用メモリ | 77,232 KB |
実行使用メモリ | 167,784 KB |
最終ジャッジ日時 | 2023-10-25 07:23:04 |
合計ジャッジ時間 | 9,637 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 572 ms
156,464 KB |
testcase_01 | AC | 54 ms
52,600 KB |
testcase_02 | AC | 53 ms
52,588 KB |
testcase_03 | AC | 51 ms
52,592 KB |
testcase_04 | AC | 51 ms
53,168 KB |
testcase_05 | AC | 50 ms
53,180 KB |
testcase_06 | AC | 49 ms
53,180 KB |
testcase_07 | AC | 51 ms
53,168 KB |
testcase_08 | AC | 51 ms
50,544 KB |
testcase_09 | AC | 51 ms
51,204 KB |
testcase_10 | AC | 51 ms
53,164 KB |
testcase_11 | AC | 51 ms
52,616 KB |
testcase_12 | AC | 51 ms
52,592 KB |
testcase_13 | AC | 532 ms
167,620 KB |
testcase_14 | AC | 525 ms
167,624 KB |
testcase_15 | AC | 530 ms
167,572 KB |
testcase_16 | AC | 544 ms
167,548 KB |
testcase_17 | AC | 522 ms
167,784 KB |
testcase_18 | AC | 529 ms
167,776 KB |
testcase_19 | AC | 510 ms
167,724 KB |
testcase_20 | AC | 513 ms
167,604 KB |
ソースコード
import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { try (InputStreamReader isr = new InputStreamReader(System.in)) { StringBuilder sb = new StringBuilder(); char[] cbuf = new char[10000]; int size; while ((size = isr.read(cbuf)) >= 0) { sb.append(cbuf, 0, size); } String[] lines = sb.toString().split("\n"); String[] ary = lines[0].trim().split(" "); int h = Integer.parseInt(ary[0]); int w = Integer.parseInt(ary[1]); int x = 0; int y = 0; for (int i = lines.length - 1; i >= 2; i--) { String line = lines[i].trim(); int k = Integer.parseInt(line.substring(2)); if (line.charAt(0) == 'R') { if (k == y) { x--; if (x < 0) x = w - 1; } } else { if (k == x) { y--; if (y < 0) y = h - 1; } } // System.err.println(String.format("%s (%d, %d)", line, x, y)); } System.out.println((x + y) % 2 == 0 ? "white" : "black"); } } }