結果

問題 No.351 市松スライドパズル
ユーザー code-devocode-devo
提出日時 2016-03-11 23:43:02
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 938 bytes
コンパイル時間 2,115 ms
コンパイル使用メモリ 78,064 KB
実行使用メモリ 191,892 KB
最終ジャッジ日時 2023-10-25 06:00:58
合計ジャッジ時間 27,972 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 129 ms
57,524 KB
testcase_02 AC 118 ms
56,300 KB
testcase_03 AC 132 ms
57,168 KB
testcase_04 AC 132 ms
57,712 KB
testcase_05 AC 132 ms
57,504 KB
testcase_06 AC 122 ms
56,316 KB
testcase_07 AC 133 ms
57,552 KB
testcase_08 AC 132 ms
57,792 KB
testcase_09 AC 138 ms
57,656 KB
testcase_10 AC 123 ms
56,220 KB
testcase_11 AC 146 ms
57,568 KB
testcase_12 AC 145 ms
57,640 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

// JavaでTLE叩き出して恥ずかしい。

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();

		int x = 0;
		int y = 0;

		List<SK> list = new ArrayList<>();
		int n = sc.nextInt();
		for (int i = 0; i < n; i++) {
			String s = sc.next();
			int k = sc.nextInt();
			SK sk = new SK(s, k);
			list.add(sk);
		}

		for (int i = list.size() - 1; i >= 0; i--) {
			SK sk = list.get(i);
			String s = sk.s;
			int k = sk.k;
			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.out.println((x + y) % 2 == 0 ? "white" : "black");
	}
}

class SK {
	final String s;
	final int k;

	SK(String s, int k) {
		this.s = s;
		this.k = k;
	}
}
0