結果

問題 No.629 グラフの中に眠る門松列
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2023-08-25 06:30:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 118 ms / 4,000 ms
コード長 591 bytes
コンパイル時間 913 ms
コンパイル使用メモリ 65,616 KB
実行使用メモリ 64,668 KB
最終ジャッジ日時 2023-08-25 10:12:50
合計ジャッジ時間 8,804 ms
ジャッジサーバーID
(参考情報)
judge000 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
58,936 KB
testcase_01 AC 99 ms
58,624 KB
testcase_02 AC 95 ms
58,948 KB
testcase_03 AC 97 ms
58,732 KB
testcase_04 AC 96 ms
58,736 KB
testcase_05 AC 94 ms
58,984 KB
testcase_06 AC 90 ms
58,884 KB
testcase_07 AC 89 ms
58,652 KB
testcase_08 AC 89 ms
58,876 KB
testcase_09 AC 92 ms
58,752 KB
testcase_10 AC 94 ms
58,732 KB
testcase_11 AC 94 ms
58,516 KB
testcase_12 AC 94 ms
58,836 KB
testcase_13 AC 91 ms
58,948 KB
testcase_14 AC 91 ms
58,912 KB
testcase_15 AC 95 ms
58,516 KB
testcase_16 AC 97 ms
58,652 KB
testcase_17 AC 94 ms
58,732 KB
testcase_18 AC 91 ms
58,732 KB
testcase_19 AC 92 ms
58,964 KB
testcase_20 AC 92 ms
58,740 KB
testcase_21 AC 105 ms
63,064 KB
testcase_22 AC 93 ms
58,972 KB
testcase_23 AC 92 ms
59,004 KB
testcase_24 AC 102 ms
63,480 KB
testcase_25 AC 103 ms
64,144 KB
testcase_26 AC 103 ms
64,540 KB
testcase_27 AC 103 ms
64,332 KB
testcase_28 AC 99 ms
58,832 KB
testcase_29 AC 100 ms
63,820 KB
testcase_30 AC 109 ms
64,456 KB
testcase_31 AC 106 ms
64,668 KB
testcase_32 AC 103 ms
63,692 KB
testcase_33 AC 118 ms
64,544 KB
testcase_34 AC 94 ms
63,744 KB
testcase_35 AC 106 ms
63,580 KB
testcase_36 AC 103 ms
63,800 KB
testcase_37 AC 108 ms
64,408 KB
testcase_38 AC 101 ms
63,936 KB
testcase_39 AC 117 ms
63,692 KB
testcase_40 AC 114 ms
64,076 KB
testcase_41 AC 112 ms
63,892 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline
N,M = map(int,input().split())
A = list(map(int,input().split()))
e = [[] for _ in range(N)]
for _ in range(M):
    u,v = map(int,input().split())
    u -= 1
    v -= 1
    e[u].append(v)
    e[v].append(u)
    
    
for i in range(N):
    
    a = A[i]
    X = list(set(A[j] for j in e[i]))
    X.sort()
    if len(X)<=1:
        continue
    if X[-2]>a:
        print('YES')
        exit()
    if X[1]<a:
        print('YES')
        exit()
print('NO')
0