結果

問題 No.351 市松スライドパズル
ユーザー AoiroFukurouAoiroFukurou
提出日時 2016-05-11 16:34:23
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 1,137 bytes
コンパイル時間 3,595 ms
コンパイル使用メモリ 77,820 KB
実行使用メモリ 501,500 KB
最終ジャッジ日時 2024-04-15 15:10:35
合計ジャッジ時間 12,734 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,494 ms
127,984 KB
testcase_01 AC 136 ms
41,480 KB
testcase_02 AC 133 ms
41,292 KB
testcase_03 AC 137 ms
41,328 KB
testcase_04 AC 133 ms
40,244 KB
testcase_05 AC 121 ms
40,484 KB
testcase_06 AC 135 ms
41,524 KB
testcase_07 AC 121 ms
40,256 KB
testcase_08 AC 126 ms
40,728 KB
testcase_09 AC 137 ms
41,280 KB
testcase_10 AC 138 ms
41,444 KB
testcase_11 AC 141 ms
41,384 KB
testcase_12 AC 141 ms
41,372 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Scanner;

public class No351 {
public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int H = sc.nextInt();//受け取り開始
	int W = sc.nextInt();
	int N = sc.nextInt();
	String[] S = new String[N+1];
	for(int i = 0; i < S.length; i++){
		S[i] = sc.nextLine();
	}//受け取り終了
	int[][] B = new int[H][W];//ブロック作成開始
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			if(i%2 == 0){
				if(j%2 == 0){
					B[i][j] = 1;
				}
			}else if(i%2 == 1){
				if(j%2 == 1){
					B[i][j] = 1;
				}
			}
		}
	}//ブロック作成終了
	for(int i = 1; i < S.length; i++){
		char c = S[i].charAt(0);
		String SNum = S[i].substring(2, 3);
		int num = Integer.parseInt(SNum);
		if(c == 'R'){
			int tmp = B[num][W-1];
			for(int j = W - 1; j >= 1; j--){
				B[num][j] = B[num][j - 1];
			}
			B[num][0] = tmp;
		}
		if(c == 'C'){
			int tmp2 = B[H-1][num];
			for(int j = H - 1; j >= 1; j--){
				B[j][num] = B[j - 1][num];
			}
			B[0][num] = tmp2;
		}
	}
	if(B[0][0]==1){
		System.out.println("white");
	}else{
		System.out.println("black");
	}
}	
}
0