結果

問題 No.351 市松スライドパズル
ユーザー NoNo
提出日時 2018-01-24 01:36:31
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 750 ms / 2,000 ms
コード長 1,362 bytes
コンパイル時間 2,464 ms
コンパイル使用メモリ 102,492 KB
実行使用メモリ 73,224 KB
最終ジャッジ日時 2023-08-26 23:59:03
合計ジャッジ時間 12,095 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 649 ms
58,080 KB
testcase_01 AC 54 ms
14,608 KB
testcase_02 AC 55 ms
14,624 KB
testcase_03 AC 53 ms
14,664 KB
testcase_04 AC 54 ms
14,560 KB
testcase_05 AC 55 ms
14,524 KB
testcase_06 AC 56 ms
14,608 KB
testcase_07 AC 54 ms
14,672 KB
testcase_08 AC 54 ms
14,568 KB
testcase_09 AC 54 ms
14,628 KB
testcase_10 AC 56 ms
14,564 KB
testcase_11 AC 53 ms
14,528 KB
testcase_12 AC 54 ms
14,604 KB
testcase_13 AC 722 ms
64,016 KB
testcase_14 AC 735 ms
72,512 KB
testcase_15 AC 750 ms
69,196 KB
testcase_16 AC 742 ms
71,224 KB
testcase_17 AC 738 ms
71,380 KB
testcase_18 AC 734 ms
73,224 KB
testcase_19 AC 737 ms
71,272 KB
testcase_20 AC 744 ms
69,188 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace y
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] ss = Console.ReadLine().Split();
            int h = int.Parse(ss[0]);
            int w = int.Parse(ss[1]);
            int n = int.Parse(Console.ReadLine());


            string[] a = new string[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = Console.ReadLine();
            }

            int x = 0, y = h - 1;
            for (int i = n - 1; i >= 0; i--)
            {
                ss = a[i].Split();
                if (ss[0] == "R" && (h - 1) - int.Parse(ss[1]) == y)
                {
                    x = x - 1;
                    if (x < 0) x = w - 1;
                }
                if (ss[0] == "C" && int.Parse(ss[1]) == x)
                {
                    y = y + 1;
                    if (y > h - 1) y = 0;
                }
            }
            string ans = "";
            if (x % 2 == 1)
            {
                ans = y % 2 == 0 ? "white" : "black";
            }
            else
            {
                ans = y % 2 == 1 ? "white" : "black";
            }

            if (h % 2 == 1)
            {
                if (ans == "black") ans = "white";
                else ans = "black";
            }

            Console.WriteLine(ans);
        }
    }
}
0