結果

問題 No.629 グラフの中に眠る門松列
ユーザー convexineq
提出日時 2021-03-03 18:24:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 381 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 82,348 KB
実行使用メモリ 71,992 KB
最終ジャッジ日時 2024-10-03 07:20:29
合計ジャッジ時間 3,496 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5 WA * 1
other AC * 28 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
*a, = map(int,input().split())
g = [[] for _ in range(n)]
for _ in range(m):
    x,y = map(int,input().split())
    g[x-1].append(y-1)
    g[y-1].append(x-1)
for x in range(n):
    le = mo = 0
    for v in g[x]:
        if a[v] < a[x]: le += 1
        if a[v] > a[x]: mo += 1
    if le >= 2 or mo >= 2:
        print("YES")
        exit()
print("NO")
0