結果

問題 No.351 市松スライドパズル
ユーザー momen999momen999
提出日時 2017-04-27 23:37:51
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,203 bytes
コンパイル時間 3,679 ms
コンパイル使用メモリ 104,464 KB
実行使用メモリ 61,592 KB
最終ジャッジ日時 2023-10-11 16:13:09
合計ジャッジ時間 14,351 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 672 ms
55,344 KB
testcase_01 AC 59 ms
22,668 KB
testcase_02 AC 57 ms
20,824 KB
testcase_03 AC 57 ms
20,920 KB
testcase_04 AC 58 ms
22,784 KB
testcase_05 AC 57 ms
20,840 KB
testcase_06 AC 57 ms
20,652 KB
testcase_07 AC 57 ms
22,800 KB
testcase_08 AC 57 ms
20,800 KB
testcase_09 AC 58 ms
22,712 KB
testcase_10 AC 57 ms
22,728 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 702 ms
58,636 KB
testcase_14 AC 710 ms
61,348 KB
testcase_15 AC 718 ms
53,392 KB
testcase_16 AC 720 ms
57,660 KB
testcase_17 AC 722 ms
59,396 KB
testcase_18 AC 712 ms
59,448 KB
testcase_19 AC 716 ms
61,592 KB
testcase_20 AC 721 ms
61,532 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.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
	static string Solve(int w, int h, int n, string[] slist, int[] klist)
	{
		int x = 0, y = 0;	// 初期位置 : R のとき x を、C のとき y を更新

		for (int ii = n - 1; ii >= 0; --ii)
		{
			// 行の押し出し
			if (slist[ii] == "R")
			{
				if (klist[ii] == y)
				{
					x = (x - 1 + w) % w;
				}
			}
			// 列の押し出し
			else if (slist[ii] == "C")
			{
				if (klist[ii] == x)
				{
					y = (y - 1 + h) % h;
				}
			}
		}

		string result = ((x + y) % 2 == 0) ? "white" : "black";

		return result;
	}

	static string No_351()
	{
		// w h
		String[] str = Console.ReadLine().Split(' ');
		int w = Int32.Parse(str[0]);
		int h = Int32.Parse(str[1]);

		// n
		int n = Int32.Parse(Console.ReadLine());

		// S K
		string[] slist = new string[1000000];
		int[] klist = new int[1000000];
		for (int ii = 0; ii < n; ++ii)
		{
			str = Console.ReadLine().Split(' ');

			slist[ii] = str[0];
			klist[ii] = Int32.Parse(str[1]);
		}

		return Solve(w, h, n, slist, klist);
	}

	static void Main(string[] args)
	{
		Console.WriteLine(No_351());
	}
}
0