結果

問題 No.351 市松スライドパズル
ユーザー fjafjafjafjafjafja
提出日時 2017-09-17 14:16:25
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 1,001 bytes
コンパイル時間 3,528 ms
コンパイル使用メモリ 77,720 KB
実行使用メモリ 486,116 KB
最終ジャッジ日時 2024-04-25 14:55:26
合計ジャッジ時間 12,512 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,431 ms
76,828 KB
testcase_01 AC 118 ms
54,076 KB
testcase_02 AC 116 ms
54,064 KB
testcase_03 AC 120 ms
53,876 KB
testcase_04 AC 116 ms
53,824 KB
testcase_05 AC 110 ms
52,956 KB
testcase_06 AC 122 ms
54,212 KB
testcase_07 AC 120 ms
54,128 KB
testcase_08 AC 116 ms
54,116 KB
testcase_09 AC 127 ms
54,112 KB
testcase_10 AC 122 ms
54,112 KB
testcase_11 AC 130 ms
54,152 KB
testcase_12 AC 130 ms
54,172 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 N351
{
	public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		int h=sc.nextInt(),w=sc.nextInt();
		int n=sc.nextInt();
		int[][] a=new int[h][w];
		int buf=0;
		for(int i=0;i<h;i++)
		{
			for(int j=(i+1)%2;j<w;j+=2)
			{
				a[i][j]++;
			}
		}


		for(int i=0;i<n;i++)
		{
			String s=sc.next();
			int num=sc.nextInt();
			if(s.equals("R"))
			{
				buf=a[num][w-1];
				for(int j=w-1;j>=1;j--)
				{
					a[num][j]=a[num][j-1];
				}
				a[num][0]=buf;
			}
			else if(s.equals("C"))
			{
				buf=a[h-1][num];
				for(int j=h-1;j>=1;j--)
				{
					a[j][num]=a[j-1][num];
				}
				a[0][num]=buf;
			}

			/*System.out.println("-----------------");
			for(int[] aa:a)
			{
				for(int aaa:aa)
				{
					System.out.print(aaa+" ");
				}
				System.out.println();
			}
			System.out.println("-----------------");*/
		}

		if(a[0][0]==1){System.out.println("black");}
		else{System.out.println("white");}

	}

}
0