結果

問題 No.870 無敵囲い
ユーザー mossari_aozoramossari_aozora
提出日時 2019-10-01 14:30:25
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 58 ms / 300 ms
コード長 1,980 bytes
コンパイル時間 2,855 ms
コンパイル使用メモリ 63,300 KB
実行使用メモリ 22,676 KB
最終ジャッジ日時 2023-09-11 16:18:31
合計ジャッジ時間 3,021 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
20,552 KB
testcase_01 AC 57 ms
20,560 KB
testcase_02 AC 57 ms
22,600 KB
testcase_03 AC 58 ms
22,676 KB
testcase_04 AC 58 ms
20,732 KB
testcase_05 AC 56 ms
20,716 KB
testcase_06 AC 57 ms
20,564 KB
testcase_07 AC 58 ms
20,572 KB
testcase_08 AC 57 ms
20,616 KB
testcase_09 AC 58 ms
18,668 KB
testcase_10 AC 57 ms
22,620 KB
testcase_11 AC 57 ms
22,540 KB
testcase_12 AC 58 ms
22,616 KB
testcase_13 AC 57 ms
20,560 KB
testcase_14 AC 57 ms
20,676 KB
testcase_15 AC 57 ms
22,548 KB
testcase_16 AC 56 ms
20,792 KB
testcase_17 AC 58 ms
20,544 KB
testcase_18 AC 57 ms
22,584 KB
testcase_19 AC 57 ms
22,660 KB
testcase_20 AC 57 ms
20,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.Numerics;
using System.Collections.Generic;
using System.Linq;

namespace Program
{
    class Program
    {
        static void Main(string[] args)
        {
            var numOfTurn = int.Parse(Console.ReadLine());
            var s = new Shougi();
            for (int i = 0; i < numOfTurn; i++)
            {
                var input = Console.ReadLine().Split(' ');
                var tCol = int.Parse(input[0]) - 1;
                var tRow = int.Parse(input[1]) - 1;
                var dCol = int.Parse(input[2]) - 1;
                var dRow = int.Parse(input[3]) - 1;
                s.Move(tRow, tCol, dRow, dCol);
            }
            if (s.IsMuteki())
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }

    public class Shougi
    {
        public string[,] Board;
        public int Size;
        public Shougi()
        {
            Board = new string[9, 9];
            Size = Board.GetLength(0);
            for (int row = 0; row < Size; row++)
            {
                for (int col = 0; col < Size; col++)
                {
                    Board[row, col] = "0";
                }
            }
            // 初期配置
            Board[7, 1] = "A";
            Board[8, 2] = "B";
            Board[8, 6] = "C";
        }

        public void Move(int targetRow, int targetCol, int destRow, int destCol)
        {
            if (Board[targetRow, targetCol] != "A" &&
                Board[targetRow, targetCol] != "B" &&
                Board[targetRow, targetCol] != "C")
            {
                return;
            }
            Board[destRow, destCol] = Board[targetRow, targetCol];
            Board[targetRow, targetCol] = "0";
        }

        public bool IsMuteki()
        {
            return Board[7, 4] == "A" && Board[7, 3] == "B" && Board[7, 5] == "C";
        }
    }
}
0