結果

問題 No.629 グラフの中に眠る門松列
ユーザー mbanmban
提出日時 2018-01-09 19:27:59
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 2,450 bytes
コンパイル時間 2,092 ms
コンパイル使用メモリ 106,824 KB
実行使用メモリ 23,932 KB
最終ジャッジ日時 2023-08-25 02:24:03
合計ジャッジ時間 6,088 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
19,664 KB
testcase_01 AC 56 ms
21,680 KB
testcase_02 AC 54 ms
19,440 KB
testcase_03 AC 56 ms
21,788 KB
testcase_04 AC 56 ms
21,620 KB
testcase_05 WA -
testcase_06 AC 58 ms
21,484 KB
testcase_07 AC 55 ms
21,564 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 57 ms
23,604 KB
testcase_11 AC 55 ms
21,652 KB
testcase_12 AC 55 ms
23,684 KB
testcase_13 WA -
testcase_14 AC 57 ms
21,684 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 55 ms
23,576 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 59 ms
21,652 KB
testcase_25 AC 60 ms
21,624 KB
testcase_26 AC 66 ms
21,632 KB
testcase_27 WA -
testcase_28 AC 64 ms
21,692 KB
testcase_29 AC 67 ms
23,780 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 67 ms
21,692 KB
testcase_33 AC 70 ms
21,716 KB
testcase_34 AC 67 ms
21,604 KB
testcase_35 AC 65 ms
21,908 KB
testcase_36 WA -
testcase_37 AC 67 ms
21,736 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 71 ms
21,748 KB
testcase_41 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;

namespace Contest
{
    class Scanner
    {
        private string[] line = new string[0];
        private int index = 0;
        public string Next()
        {
            if (line.Length <= index)
            {
                line = Console.ReadLine().Split(' ');
                index = 0;
            }
            var res = line[index];
            index++;
            return res;
        }
        public int NextInt()
        {
            return int.Parse(Next());
        }
        public long NextLong()
        {
            return long.Parse(Next());
        }
        public string[] Array()
        {
            line = Console.ReadLine().Split(' ');
            index = line.Length;
            return line;
        }
        public int[] IntArray()
        {
            return Array().Select(int.Parse).ToArray();
        }
        public long[] LongArray()
        {
            return Array().Select(long.Parse).ToArray();
        }
    }

    class Program
    {
        private int N, M;
        private int[] A;
        private List<int>[] R;
        public void Solve()
        {
            var sc = new Scanner();
            N = sc.NextInt();
            M = sc.NextInt();
            A = sc.IntArray();
            R = new List<int>[N];
            for (int i = 0; i < N; i++)
            {
                R[i] = new List<int>();
            }
            for (int i = 0; i < M; i++)
            {
                var u = sc.NextInt() - 1;
                var v = sc.NextInt() - 1;
                R[u].Add(v);
                R[v].Add(u);
            }

            for (int i = 0; i < N; i++)
            {
                bool less = false;
                bool great = false;
                foreach (int j in R[i])
                {
                    if (A[j] < A[i])
                    {
                        less = true;
                    }
                    if (A[j] > A[i])
                    {
                        great = true;
                    }
                }
                if (less && great)
                {
                    Console.WriteLine("YES");
                    return;
                }
            }
            Console.WriteLine("NO");
        }

        static void Main(string[] args)
        {
            new Program().Solve();
        }
    }
}
0