結果

問題 No.629 グラフの中に眠る門松列
ユーザー eiji0313eiji0313
提出日時 2018-01-06 18:51:17
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 29 ms / 4,000 ms
コード長 568 bytes
コンパイル時間 76 ms
コンパイル使用メモリ 10,796 KB
実行使用メモリ 8,672 KB
最終ジャッジ日時 2023-08-24 22:21:37
合計ジャッジ時間 2,366 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,164 KB
testcase_01 AC 15 ms
7,876 KB
testcase_02 AC 15 ms
8,240 KB
testcase_03 AC 15 ms
8,212 KB
testcase_04 AC 15 ms
8,320 KB
testcase_05 AC 16 ms
8,092 KB
testcase_06 AC 16 ms
7,828 KB
testcase_07 AC 16 ms
7,856 KB
testcase_08 AC 14 ms
7,804 KB
testcase_09 AC 15 ms
8,264 KB
testcase_10 AC 14 ms
8,296 KB
testcase_11 AC 15 ms
8,216 KB
testcase_12 AC 14 ms
8,268 KB
testcase_13 AC 14 ms
8,184 KB
testcase_14 AC 14 ms
7,800 KB
testcase_15 AC 15 ms
8,192 KB
testcase_16 AC 15 ms
8,100 KB
testcase_17 AC 15 ms
8,160 KB
testcase_18 AC 15 ms
8,260 KB
testcase_19 AC 14 ms
8,200 KB
testcase_20 AC 14 ms
7,792 KB
testcase_21 AC 19 ms
8,344 KB
testcase_22 AC 18 ms
8,256 KB
testcase_23 AC 19 ms
8,308 KB
testcase_24 AC 26 ms
8,360 KB
testcase_25 AC 26 ms
8,184 KB
testcase_26 AC 28 ms
8,388 KB
testcase_27 AC 28 ms
8,672 KB
testcase_28 AC 18 ms
8,348 KB
testcase_29 AC 24 ms
8,448 KB
testcase_30 AC 29 ms
8,644 KB
testcase_31 AC 28 ms
8,520 KB
testcase_32 AC 27 ms
8,524 KB
testcase_33 AC 29 ms
8,656 KB
testcase_34 AC 24 ms
8,568 KB
testcase_35 AC 24 ms
8,436 KB
testcase_36 AC 27 ms
8,632 KB
testcase_37 AC 24 ms
8,288 KB
testcase_38 AC 27 ms
8,532 KB
testcase_39 AC 25 ms
8,424 KB
testcase_40 AC 21 ms
8,496 KB
testcase_41 AC 20 ms
8,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = [int(x) for x in input().split()]
score = [int(x) for x in input().split()]
g = [[] for i in range(n)]
for i in range(m):
    u, v = [int(x) for x in input().split()]
    g[u - 1].append(v - 1)
    g[v - 1].append(u - 1)

for i, v in enumerate(g):
    tmp = [score[j] for j in v if score[i] < score[j]]
    if len(tmp) >=2:
        if len(set(tmp)) >=2:
            print("YES")
            exit()

    tmp = [score[j] for j in v if score[i] > score[j]]
    if len(tmp) >=2:
        if len(set(tmp)) >=2:
            print("YES")
            exit()

print("NO")
0