結果

問題 No.351 市松スライドパズル
ユーザー momen999momen999
提出日時 2017-04-28 14:41:01
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 720 ms / 2,000 ms
コード長 1,286 bytes
コンパイル時間 923 ms
コンパイル使用メモリ 108,800 KB
実行使用メモリ 62,692 KB
最終ジャッジ日時 2023-10-25 07:52:14
合計ジャッジ時間 9,513 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 649 ms
62,440 KB
testcase_01 AC 25 ms
24,144 KB
testcase_02 AC 25 ms
24,144 KB
testcase_03 AC 25 ms
24,144 KB
testcase_04 AC 25 ms
24,144 KB
testcase_05 AC 26 ms
24,144 KB
testcase_06 AC 25 ms
24,144 KB
testcase_07 AC 25 ms
24,144 KB
testcase_08 AC 25 ms
24,144 KB
testcase_09 AC 25 ms
24,144 KB
testcase_10 AC 25 ms
24,144 KB
testcase_11 AC 25 ms
24,144 KB
testcase_12 AC 25 ms
24,144 KB
testcase_13 AC 705 ms
62,208 KB
testcase_14 AC 708 ms
62,328 KB
testcase_15 AC 720 ms
62,520 KB
testcase_16 AC 720 ms
62,524 KB
testcase_17 AC 712 ms
62,524 KB
testcase_18 AC 710 ms
62,524 KB
testcase_19 AC 716 ms
62,692 KB
testcase_20 AC 719 ms
62,692 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;

        for (int ii = n - 1; ii >= 0; --ii)
        {
            if (slist[ii] == "R" && klist[ii] == y)
            {
                x = (x - 1 < 0) ? w - 1 : x - 1;
            }
            else if (slist[ii] == "C" && klist[ii] == x)
            {
                y = (y - 1 < 0) ? h - 1 : y - 1;
            }
        }

        return ((x + y) % 2 == 0) ? "white" : "black";
    }

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

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

        // S K
        string[] slist = new string[n];
        int[] klist = new int[n];
        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