結果

問題 No.240 ナイト散歩
ユーザー mbanmban
提出日時 2016-12-23 14:48:13
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 1,372 bytes
コンパイル時間 2,350 ms
コンパイル使用メモリ 107,460 KB
実行使用メモリ 24,964 KB
最終ジャッジ日時 2023-07-29 13:47:36
合計ジャッジ時間 5,536 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
22,556 KB
testcase_01 AC 61 ms
24,964 KB
testcase_02 AC 61 ms
20,580 KB
testcase_03 AC 61 ms
22,684 KB
testcase_04 AC 61 ms
24,744 KB
testcase_05 AC 60 ms
22,736 KB
testcase_06 AC 60 ms
24,684 KB
testcase_07 AC 61 ms
24,760 KB
testcase_08 AC 62 ms
24,672 KB
testcase_09 AC 61 ms
24,788 KB
testcase_10 AC 61 ms
22,716 KB
testcase_11 AC 60 ms
22,612 KB
testcase_12 AC 60 ms
22,684 KB
testcase_13 AC 61 ms
22,736 KB
testcase_14 AC 61 ms
22,688 KB
testcase_15 AC 61 ms
22,744 KB
testcase_16 AC 60 ms
22,752 KB
testcase_17 AC 60 ms
22,656 KB
testcase_18 AC 60 ms
22,768 KB
testcase_19 AC 60 ms
22,732 KB
testcase_20 AC 61 ms
22,768 KB
testcase_21 AC 61 ms
22,716 KB
testcase_22 AC 61 ms
24,696 KB
testcase_23 AC 61 ms
22,636 KB
testcase_24 AC 62 ms
22,656 KB
testcase_25 AC 60 ms
22,780 KB
testcase_26 AC 61 ms
22,704 KB
testcase_27 AC 62 ms
22,648 KB
testcase_28 AC 61 ms
24,740 KB
testcase_29 AC 60 ms
22,804 KB
testcase_30 AC 60 ms
22,844 KB
testcase_31 AC 61 ms
24,764 KB
testcase_32 AC 61 ms
22,744 KB
testcase_33 AC 61 ms
22,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;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;

class Magatro
{
    static int[] IdouX = new int[8] { -2, -2, -1, -1, 1, 1, 2, 2 };
    static int[] IdouY = new int[8] { -1, 1, -2, 2, -2, 2, -1, 1 };
    static void Main()
    {
        XY P;
        string[] s = Console.ReadLine().Split(' ');
        P.X = long.Parse(s[0]);
        P.Y = long.Parse(s[1]);
        HashSet<XY>[] Hs = new HashSet<XY>[4];
        for(int i = 0; i < 4; i++)
        {
            Hs[i] = new HashSet<XY>();
        }
        Hs[0].Add(new XY(0, 0));
        for(int i = 1; i <= 3; i++)
        {
            foreach(XY v in Hs[i-1].ToArray())
            {
             
                for(int j = 0; j < 8; j++)
                {
                    XY q = v;
                    q.X += IdouX[j];
                    q.Y += IdouY[j];
                    Hs[i].Add(q);
                }
            }
        }
        for (int i = 0; i < 4; i++)
        {
            if (Hs[i].Contains(P))
            {
                Console.WriteLine("YES");
                return;
            }
        }
        Console.WriteLine("NO");


    }

}
struct XY
{
    public long X, Y;
    public XY(long x,long y)
    {
        X = x;
        Y = y;
    }
}
0