結果

問題 No.629 グラフの中に眠る門松列
ユーザー バカらっくバカらっく
提出日時 2018-01-05 22:32:42
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 2,236 bytes
コンパイル時間 5,047 ms
コンパイル使用メモリ 108,232 KB
実行使用メモリ 24,180 KB
最終ジャッジ日時 2023-08-24 20:58:07
合計ジャッジ時間 8,183 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
19,872 KB
testcase_01 WA -
testcase_02 AC 64 ms
23,932 KB
testcase_03 AC 65 ms
23,836 KB
testcase_04 AC 64 ms
21,912 KB
testcase_05 AC 64 ms
21,896 KB
testcase_06 AC 60 ms
21,812 KB
testcase_07 AC 66 ms
21,796 KB
testcase_08 AC 64 ms
21,944 KB
testcase_09 AC 64 ms
23,828 KB
testcase_10 AC 63 ms
21,972 KB
testcase_11 AC 63 ms
21,848 KB
testcase_12 AC 64 ms
21,920 KB
testcase_13 AC 63 ms
21,856 KB
testcase_14 WA -
testcase_15 AC 64 ms
21,828 KB
testcase_16 AC 64 ms
21,908 KB
testcase_17 AC 65 ms
21,872 KB
testcase_18 AC 64 ms
21,796 KB
testcase_19 AC 65 ms
21,800 KB
testcase_20 AC 65 ms
21,780 KB
testcase_21 WA -
testcase_22 AC 75 ms
23,948 KB
testcase_23 AC 73 ms
21,860 KB
testcase_24 AC 69 ms
21,772 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 77 ms
21,900 KB
testcase_28 WA -
testcase_29 AC 76 ms
19,860 KB
testcase_30 AC 78 ms
22,056 KB
testcase_31 AC 76 ms
21,908 KB
testcase_32 AC 78 ms
24,020 KB
testcase_33 WA -
testcase_34 AC 77 ms
22,136 KB
testcase_35 AC 76 ms
24,112 KB
testcase_36 AC 78 ms
19,980 KB
testcase_37 WA -
testcase_38 AC 76 ms
21,888 KB
testcase_39 AC 76 ms
23,944 KB
testcase_40 WA -
testcase_41 AC 74 ms
23,928 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.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {
        int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();

        int pointCount = inpt[0];
        int pathCount = inpt[1];

        int[] pointList = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();

        Dictionary<int, Dictionary<int, bool>> path = new Dictionary<int, Dictionary<int, bool>>();
        for (int i = 0; i < pathCount; i++) {
            inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a) - 1).ToArray();
            if(!path.ContainsKey(inpt[0])) {
                path.Add(inpt[0], new Dictionary<int, bool>());
            }
            path[inpt[0]].Add(inpt[1], true);
            if(!path.ContainsKey(inpt[1])) {
                path.Add(inpt[1], new Dictionary<int, bool>());
            }
            path[inpt[1]].Add(inpt[0], true);
        }
        bool hasKadomatu = false;
        for (int i = 0; i < pointCount; i++) {
            int num = pointList[i];
            if(!path.ContainsKey(i)) {
                continue;
            }
            if(path[i].Count(a=>pointList[a.Key]<num)>=2) {
                hasKadomatu = true;
                break;
            } else if(path[i].Count(a=>pointList[a.Key]>num)>=2) {
                hasKadomatu = true;
                break;
            }
        }
        Console.WriteLine(hasKadomatu?"YES":"NO");
    }



    public class Reader
    {
        private static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"



3 2
1 3 2
1 2
2 3


";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}
0