結果

問題 No.629 グラフの中に眠る門松列
ユーザー convexineqconvexineq
提出日時 2021-03-03 18:27:08
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 521 bytes
コンパイル時間 341 ms
コンパイル使用メモリ 87,368 KB
実行使用メモリ 77,284 KB
最終ジャッジ日時 2023-07-26 20:58:29
合計ジャッジ時間 5,101 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,188 KB
testcase_01 AC 67 ms
71,324 KB
testcase_02 AC 65 ms
71,480 KB
testcase_03 AC 66 ms
71,376 KB
testcase_04 AC 64 ms
71,516 KB
testcase_05 AC 67 ms
71,196 KB
testcase_06 AC 67 ms
71,368 KB
testcase_07 AC 69 ms
71,480 KB
testcase_08 AC 67 ms
71,592 KB
testcase_09 AC 67 ms
71,172 KB
testcase_10 AC 68 ms
71,560 KB
testcase_11 AC 68 ms
71,396 KB
testcase_12 AC 68 ms
71,328 KB
testcase_13 WA -
testcase_14 AC 67 ms
71,480 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 64 ms
71,388 KB
testcase_21 AC 81 ms
76,532 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 88 ms
76,664 KB
testcase_25 AC 90 ms
76,968 KB
testcase_26 AC 92 ms
77,136 KB
testcase_27 WA -
testcase_28 AC 72 ms
71,512 KB
testcase_29 AC 92 ms
77,284 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 90 ms
76,828 KB
testcase_33 AC 93 ms
77,112 KB
testcase_34 AC 90 ms
77,004 KB
testcase_35 AC 90 ms
76,864 KB
testcase_36 WA -
testcase_37 AC 94 ms
77,144 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 90 ms
76,924 KB
testcase_41 WA -
権限があれば一括ダウンロードができます

ソースコード

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 = set()
    mo = set()
    for v in g[x]:
        if a[v] < a[x]:
            if le and a[v] not in le:
                print("YES")
                exit()
            le.add(a[v])
        if a[v] > a[x]:
            if mo and a[v] not in mo:
                print("YES")
                exit()
print("NO")
0