結果

問題 No.351 市松スライドパズル
ユーザー kuuso1kuuso1
提出日時 2017-07-01 15:36:29
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 1,000 ms / 2,000 ms
コード長 1,441 bytes
コンパイル時間 1,278 ms
コンパイル使用メモリ 115,008 KB
実行使用メモリ 139,900 KB
最終ジャッジ日時 2024-04-15 10:22:46
合計ジャッジ時間 12,367 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 842 ms
129,396 KB
testcase_01 AC 26 ms
23,728 KB
testcase_02 AC 27 ms
24,116 KB
testcase_03 AC 27 ms
23,688 KB
testcase_04 AC 26 ms
23,984 KB
testcase_05 AC 27 ms
24,240 KB
testcase_06 AC 27 ms
23,820 KB
testcase_07 AC 27 ms
24,116 KB
testcase_08 AC 26 ms
21,940 KB
testcase_09 AC 27 ms
21,812 KB
testcase_10 AC 26 ms
23,688 KB
testcase_11 AC 27 ms
24,072 KB
testcase_12 AC 26 ms
24,108 KB
testcase_13 AC 906 ms
136,676 KB
testcase_14 AC 1,000 ms
137,720 KB
testcase_15 AC 925 ms
136,116 KB
testcase_16 AC 929 ms
139,764 KB
testcase_17 AC 934 ms
139,520 KB
testcase_18 AC 918 ms
137,716 KB
testcase_19 AC 931 ms
139,900 KB
testcase_20 AC 928 ms
139,848 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int r = 0, c = 0;
		for(int i=N-1;i>=0;i--){
			switch (Q[i][0][0]){
				case 'R':
					int tr = int.Parse(Q[i][1]);
					if(r == tr){
						c--;
						if(c < 0) c += W;
					}
					break;
				case 'C':
					int tc = int.Parse(Q[i][1]);
					if(c == tc){
						r--;
						if(r < 0) r += H;
					}
					break;
			}
			//Console.WriteLine("r:{0} c:{1}",r,c);
		}
		Console.WriteLine((r+c) % 2 != 0 ? "black" : "white");
		
	}
	int H,W;
	int N;
	String[][] Q;
	public Sol(){
		var d = ria();
		H = d[0]; W = d[1];
		N = ri();
		Q = new String[N][];
		for(int i=0;i<N;i++) Q[i] = rsa();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}
0