結果

問題 No.351 市松スライドパズル
ユーザー 37zigen37zigen
提出日時 2016-03-12 03:54:43
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,710 ms / 2,000 ms
コード長 930 bytes
コンパイル時間 3,460 ms
コンパイル使用メモリ 77,864 KB
実行使用メモリ 66,564 KB
最終ジャッジ日時 2023-10-25 06:33:23
合計ジャッジ時間 22,305 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,527 ms
62,844 KB
testcase_01 AC 120 ms
40,012 KB
testcase_02 AC 131 ms
41,268 KB
testcase_03 AC 131 ms
41,188 KB
testcase_04 AC 131 ms
41,372 KB
testcase_05 AC 118 ms
40,032 KB
testcase_06 AC 118 ms
40,032 KB
testcase_07 AC 117 ms
40,040 KB
testcase_08 AC 128 ms
41,244 KB
testcase_09 AC 131 ms
41,036 KB
testcase_10 AC 126 ms
40,964 KB
testcase_11 AC 144 ms
41,424 KB
testcase_12 AC 143 ms
41,516 KB
testcase_13 AC 1,610 ms
62,684 KB
testcase_14 AC 1,603 ms
62,764 KB
testcase_15 AC 1,710 ms
66,564 KB
testcase_16 AC 1,565 ms
65,636 KB
testcase_17 AC 1,598 ms
62,848 KB
testcase_18 AC 1,570 ms
62,816 KB
testcase_19 AC 1,483 ms
64,076 KB
testcase_20 AC 1,582 ms
64,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package 練習;
import java.io.PrintWriter;
import java.util.Scanner;
public class main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		PrintWriter pw=new PrintWriter(System.out);
		//long exec_time=new Date().getTime();

		int h=sc.nextInt();
		int w=sc.nextInt();
		int n=sc.nextInt();
		int x=0;
		int y=0;
		char[] s=new char[n];
		int[] k=new int[n];

		for(int i=0;i<n;i++){
			s[i]=sc.next().toCharArray()[0];
			k[i]=sc.nextInt();
		}
		for(int i=n-1;i>=0;i--){
			if(s[i]=='R'){
				if(k[i]==y){
					if(x==0){
						x=w-1;
					}else if(x!=0)x--;
				}
			}else if(s[i]=='C'){
				if(k[i]==x){
					if(y==0){
						y=h-1;
					}else if(y!=0)y--;
				}
			}
			//pw.println("x="+x+"\ny="+y);

		}

		if((x+y)%2==0){
			pw.println("white");
		}else if((x+y)%2==1){
			pw.println("black");
		}
		pw.close();
		sc.close();
	}
	//System.err.println(new Date().getTime()-exec_time+"ms");
	
}

0