結果

問題 No.629 グラフの中に眠る門松列
ユーザー htkbhtkb
提出日時 2018-04-20 21:08:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 154 ms / 4,000 ms
コード長 599 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 10,908 KB
実行使用メモリ 8,932 KB
最終ジャッジ日時 2023-09-09 12:11:38
合計ジャッジ時間 3,167 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,552 KB
testcase_01 AC 19 ms
8,472 KB
testcase_02 AC 19 ms
8,424 KB
testcase_03 AC 19 ms
8,508 KB
testcase_04 AC 20 ms
8,468 KB
testcase_05 AC 19 ms
8,552 KB
testcase_06 AC 19 ms
8,432 KB
testcase_07 AC 19 ms
8,412 KB
testcase_08 AC 19 ms
8,556 KB
testcase_09 AC 19 ms
8,604 KB
testcase_10 AC 19 ms
8,408 KB
testcase_11 AC 18 ms
8,464 KB
testcase_12 AC 19 ms
8,428 KB
testcase_13 AC 19 ms
8,424 KB
testcase_14 AC 19 ms
8,360 KB
testcase_15 AC 19 ms
8,516 KB
testcase_16 AC 19 ms
8,472 KB
testcase_17 AC 19 ms
8,424 KB
testcase_18 AC 19 ms
8,424 KB
testcase_19 AC 19 ms
8,516 KB
testcase_20 AC 19 ms
8,524 KB
testcase_21 AC 154 ms
8,552 KB
testcase_22 AC 22 ms
8,644 KB
testcase_23 AC 23 ms
8,560 KB
testcase_24 AC 30 ms
8,708 KB
testcase_25 AC 42 ms
8,672 KB
testcase_26 AC 100 ms
8,636 KB
testcase_27 AC 32 ms
8,844 KB
testcase_28 AC 21 ms
8,536 KB
testcase_29 AC 28 ms
8,804 KB
testcase_30 AC 31 ms
8,800 KB
testcase_31 AC 31 ms
8,892 KB
testcase_32 AC 30 ms
8,740 KB
testcase_33 AC 33 ms
8,864 KB
testcase_34 AC 27 ms
8,908 KB
testcase_35 AC 27 ms
8,716 KB
testcase_36 AC 31 ms
8,804 KB
testcase_37 AC 28 ms
8,884 KB
testcase_38 AC 30 ms
8,932 KB
testcase_39 AC 28 ms
8,696 KB
testcase_40 AC 25 ms
8,620 KB
testcase_41 AC 25 ms
8,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
N, M = map(int, input().split())
a = tuple(map(int, input().split()))
vertices = [[] for _ in [0]*N]
for _ in [0]*M:
    u, v = map(int, input().split())
    vertices[u-1].append(v-1)
    vertices[v-1].append(u-1)

for i in range(N):
    i_value = a[i]
    for j in vertices[i]:
        j_value = a[j]
        if i_value == j_value:
            continue
        for k in vertices[j]:
            if i == k or i_value == a[k]:
                continue
            if (i_value-j_value) * (a[k]-j_value) > 0:
                print("YES")
                exit()
print("NO")
0