結果

問題 No.351 市松スライドパズル
ユーザー fjafjafjafjafjafja
提出日時 2017-09-17 14:38:32
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 666 bytes
コンパイル時間 3,307 ms
コンパイル使用メモリ 77,512 KB
実行使用メモリ 157,320 KB
最終ジャッジ日時 2024-04-25 14:56:11
合計ジャッジ時間 26,061 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,945 ms
156,128 KB
testcase_01 AC 106 ms
52,804 KB
testcase_02 AC 122 ms
53,964 KB
testcase_03 AC 111 ms
52,896 KB
testcase_04 AC 124 ms
54,160 KB
testcase_05 AC 121 ms
54,124 KB
testcase_06 AC 124 ms
54,036 KB
testcase_07 WA -
testcase_08 AC 122 ms
54,300 KB
testcase_09 AC 125 ms
54,304 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 AC 1,997 ms
155,960 KB
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class N351
{
	public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		int h=sc.nextInt(),w=sc.nextInt();
		int n=sc.nextInt();
		String[] s=new String[n];
		int[] k=new int[n];
		int nowh=0,noww=0;
		for(int i=0;i<n;i++)
		{
			s[i]=sc.next();
			k[i]=sc.nextInt();

		}
		for(int i=n-1;n>=0;n--)
		{
			if(s[i].equals("R"))
			{
				if(k[i]==nowh)
				{
					noww--;noww=(noww==-1)?w-1:noww;
				}
			}
			if(s[i].equals("C"))
			{
				if(k[i]==noww)
				{
					nowh--;nowh=(nowh==-1)?h-1:nowh;
				}
			}
		}
		if((nowh+noww)%2==0){System.out.println("white");}
		else{System.out.println("black");}

	}

}
0