結果

問題 No.351 市松スライドパズル
ユーザー 37zigen37zigen
提出日時 2016-04-01 20:15:10
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,639 ms / 2,000 ms
コード長 817 bytes
コンパイル時間 1,919 ms
コンパイル使用メモリ 77,716 KB
実行使用メモリ 152,648 KB
最終ジャッジ日時 2024-04-10 07:14:23
合計ジャッジ時間 19,914 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,513 ms
151,876 KB
testcase_01 AC 106 ms
53,340 KB
testcase_02 AC 106 ms
52,988 KB
testcase_03 AC 101 ms
52,816 KB
testcase_04 AC 104 ms
52,564 KB
testcase_05 AC 113 ms
53,876 KB
testcase_06 AC 117 ms
53,952 KB
testcase_07 AC 112 ms
53,772 KB
testcase_08 AC 101 ms
52,980 KB
testcase_09 AC 116 ms
53,932 KB
testcase_10 AC 120 ms
53,956 KB
testcase_11 AC 128 ms
54,280 KB
testcase_12 AC 124 ms
54,396 KB
testcase_13 AC 1,519 ms
146,548 KB
testcase_14 AC 1,639 ms
152,648 KB
testcase_15 AC 1,562 ms
151,616 KB
testcase_16 AC 1,446 ms
150,880 KB
testcase_17 AC 1,465 ms
151,096 KB
testcase_18 AC 1,559 ms
151,816 KB
testcase_19 AC 1,501 ms
151,476 KB
testcase_20 AC 1,535 ms
151,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder351;
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);
		int h=Integer.parseInt(sc.next());
		int w=Integer.parseInt(sc.next());
		int n=Integer.parseInt(sc.next());
		int x=0;
		int y=0;
		String[] s=new String[n];
		int[] k=new int[n];
		for(int i=0;i<n;i++){
			s[i]=sc.next();
			//行の操作R、列の操作C
			k[i]=Integer.parseInt(sc.next());
		}
		for(int i=n-1;i>=0;i--){
			if(s[i].equals("R")&&k[i]==y){
				if(x==0){
					x=w-1;
				}else if(x!=0){
					x--;
				}
			}else if(s[i].equals("C")&&k[i]==x){
				if(y==0){
					y=h-1;
				}else if(y!=0){
					y--;
				}
			}
		}
		pw.println((x+y)%2==0?"white":"black");
		pw.close();
	}
}
0