結果

問題 No.629 グラフの中に眠る門松列
ユーザー convexineqconvexineq
提出日時 2021-03-03 18:29:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 71 ms / 4,000 ms
コード長 439 bytes
コンパイル時間 359 ms
コンパイル使用メモリ 82,324 KB
実行使用メモリ 72,688 KB
最終ジャッジ日時 2024-04-14 10:23:33
合計ジャッジ時間 4,172 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,832 KB
testcase_01 AC 38 ms
53,436 KB
testcase_02 AC 38 ms
52,864 KB
testcase_03 AC 38 ms
52,440 KB
testcase_04 AC 38 ms
52,880 KB
testcase_05 AC 38 ms
52,772 KB
testcase_06 AC 39 ms
53,068 KB
testcase_07 AC 38 ms
52,544 KB
testcase_08 AC 39 ms
54,052 KB
testcase_09 AC 38 ms
52,332 KB
testcase_10 AC 38 ms
53,540 KB
testcase_11 AC 38 ms
53,680 KB
testcase_12 AC 38 ms
52,156 KB
testcase_13 AC 38 ms
52,868 KB
testcase_14 AC 39 ms
53,148 KB
testcase_15 AC 38 ms
53,424 KB
testcase_16 AC 39 ms
52,608 KB
testcase_17 AC 39 ms
52,680 KB
testcase_18 AC 38 ms
52,820 KB
testcase_19 AC 39 ms
52,712 KB
testcase_20 AC 38 ms
52,000 KB
testcase_21 AC 57 ms
66,000 KB
testcase_22 AC 54 ms
63,820 KB
testcase_23 AC 54 ms
62,868 KB
testcase_24 AC 65 ms
69,752 KB
testcase_25 AC 67 ms
71,372 KB
testcase_26 AC 71 ms
71,860 KB
testcase_27 AC 70 ms
72,344 KB
testcase_28 AC 45 ms
56,372 KB
testcase_29 AC 64 ms
69,948 KB
testcase_30 AC 69 ms
71,808 KB
testcase_31 AC 68 ms
72,208 KB
testcase_32 AC 67 ms
70,556 KB
testcase_33 AC 68 ms
72,688 KB
testcase_34 AC 67 ms
71,744 KB
testcase_35 AC 65 ms
70,164 KB
testcase_36 AC 64 ms
70,544 KB
testcase_37 AC 70 ms
72,064 KB
testcase_38 AC 65 ms
70,476 KB
testcase_39 AC 66 ms
69,788 KB
testcase_40 AC 67 ms
70,428 KB
testcase_41 AC 65 ms
69,272 KB
権限があれば一括ダウンロードができます

ソースコード

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]:
            le.add(a[v])
        if a[v] > a[x]:
            mo.add(a[v])
    if len(le) >= 2 or len(mo) >= 2:
        print("YES")
        exit()
print("NO")
0