結果

問題 No.629 グラフの中に眠る門松列
ユーザー Bioinfo_KBioinfo_K
提出日時 2018-01-05 23:16:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 761 bytes
コンパイル時間 534 ms
コンパイル使用メモリ 10,924 KB
実行使用メモリ 9,020 KB
最終ジャッジ日時 2023-08-24 21:16:37
合計ジャッジ時間 2,868 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,520 KB
testcase_01 AC 18 ms
8,456 KB
testcase_02 AC 18 ms
8,452 KB
testcase_03 WA -
testcase_04 AC 18 ms
8,676 KB
testcase_05 AC 19 ms
8,488 KB
testcase_06 AC 19 ms
8,600 KB
testcase_07 AC 19 ms
8,488 KB
testcase_08 AC 18 ms
8,524 KB
testcase_09 WA -
testcase_10 AC 19 ms
8,596 KB
testcase_11 AC 18 ms
8,652 KB
testcase_12 WA -
testcase_13 AC 19 ms
8,580 KB
testcase_14 AC 19 ms
8,532 KB
testcase_15 AC 18 ms
8,528 KB
testcase_16 AC 19 ms
8,692 KB
testcase_17 AC 19 ms
8,520 KB
testcase_18 AC 18 ms
8,660 KB
testcase_19 AC 18 ms
8,496 KB
testcase_20 AC 19 ms
8,512 KB
testcase_21 AC 20 ms
8,716 KB
testcase_22 AC 20 ms
8,604 KB
testcase_23 AC 21 ms
8,612 KB
testcase_24 AC 24 ms
8,764 KB
testcase_25 AC 25 ms
8,824 KB
testcase_26 AC 26 ms
8,820 KB
testcase_27 AC 25 ms
8,868 KB
testcase_28 AC 20 ms
8,564 KB
testcase_29 AC 22 ms
8,868 KB
testcase_30 AC 26 ms
9,020 KB
testcase_31 AC 27 ms
8,952 KB
testcase_32 AC 24 ms
8,804 KB
testcase_33 AC 27 ms
8,816 KB
testcase_34 AC 23 ms
8,936 KB
testcase_35 AC 23 ms
8,724 KB
testcase_36 AC 24 ms
8,932 KB
testcase_37 AC 24 ms
8,784 KB
testcase_38 AC 24 ms
8,920 KB
testcase_39 AC 22 ms
8,780 KB
testcase_40 AC 22 ms
8,832 KB
testcase_41 AC 21 ms
8,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,collections
from operator import itemgetter
sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

n,m = Is()
As = [0] + Is()
g = [[] for i in range(n+1)]
for i in range(m):
    u,v = Is()
    g[u].append(v)
    g[v].append(u)
for i,a in enumerate(As):
    if i == 0 or i == n:
        continue
    if len(g[i]) >= 2:
        big,small = [],[]
        for e in g[i]:
            if As[e] > a:
                big.append(As[e])
            if As[e] < a:
                small.append(As[e])
        if len(set(big)) >= 2 or len(set(small)) >= 2:
            print("YES")
            exit()
print("NO")
0