結果

問題 No.870 無敵囲い
ユーザー naimonon77naimonon77
提出日時 2019-10-29 17:26:40
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 61 ms / 300 ms
コード長 2,043 bytes
コンパイル時間 875 ms
コンパイル使用メモリ 67,588 KB
実行使用メモリ 23,792 KB
最終ジャッジ日時 2023-09-11 16:19:40
合計ジャッジ時間 3,109 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
21,632 KB
testcase_01 AC 60 ms
21,644 KB
testcase_02 AC 60 ms
21,496 KB
testcase_03 AC 59 ms
23,644 KB
testcase_04 AC 60 ms
23,520 KB
testcase_05 AC 60 ms
21,736 KB
testcase_06 AC 60 ms
21,664 KB
testcase_07 AC 60 ms
23,620 KB
testcase_08 AC 60 ms
23,600 KB
testcase_09 AC 60 ms
21,696 KB
testcase_10 AC 60 ms
23,676 KB
testcase_11 AC 59 ms
21,556 KB
testcase_12 AC 60 ms
23,616 KB
testcase_13 AC 59 ms
21,532 KB
testcase_14 AC 59 ms
21,608 KB
testcase_15 AC 60 ms
23,732 KB
testcase_16 AC 60 ms
23,792 KB
testcase_17 AC 59 ms
21,612 KB
testcase_18 AC 60 ms
21,536 KB
testcase_19 AC 61 ms
23,672 KB
testcase_20 AC 60 ms
21,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Runtime.CompilerServices;
//using System.Web.UI;
using Debug = System.Diagnostics.Debug;
// using System.Drawing.Primitives;
//using System.Drawing;
using System.Windows;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            new Solver().Solve();
        }
    }

    class Solver
    {
        public const double inf = double.PositiveInfinity;
        readonly TextWriter error = Console.Error;

        private void Rep(int n_, Action<int> action)
        {
            for (int i = 0; i < n_; i++)
            {
                action(i);
            }
        }

        public string ReadLine()
        {
            return Console.ReadLine();
        }

        public int Stoi(string s)
        {
            return int.Parse(s);
        }

        int n;

        public void Solve()
        { 
            n = int.Parse(ReadLine());
            var x = new int[n, 3];
            var y = new int[n, 3];

            Rep(n, (i) =>
            {
                var a = ReadLine().Split(' ').Select(s => Stoi(s)).ToArray();
                //Rep(2, (j) =>
                //{
                //    x[i, 1 + j] = a[2 * j];
                //    y[i, 1 + j + 1] = a[2 * j];
                //});
                x[i, 1] = a[0];
                y[i, 1] = a[1];
                x[i, 2] = a[2];
                y[i, 2] = a[3];
            });

            var cur = new int[10, 10];
            cur[2, 8] = 1;
            cur[3, 9] = 2;
            cur[7, 9] = 3;

            Rep(n, (i) =>
            {
                cur[x[i, 2], y[i, 2]] = cur[x[i, 1], y[i, 1]];
                cur[x[i, 1], y[i, 1]] = 0;
            });
            bool ok = false;
            if (cur[5, 8] == 1 && 
                cur[4, 8] == 2 && 
                cur[6, 8] == 3) ok = true;
            Console.WriteLine(ok ? "YES" : "NO");
        }
    }
}
0