結果

問題 No.629 グラフの中に眠る門松列
ユーザー roarisroaris
提出日時 2019-09-01 20:25:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 170 ms / 4,000 ms
コード長 613 bytes
コンパイル時間 2,502 ms
コンパイル使用メモリ 86,596 KB
実行使用メモリ 77,440 KB
最終ジャッジ日時 2023-08-19 12:50:06
合計ジャッジ時間 6,582 ms
ジャッジサーバーID
(参考情報)
judge10 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,224 KB
testcase_01 AC 71 ms
71,336 KB
testcase_02 AC 71 ms
70,944 KB
testcase_03 AC 70 ms
70,924 KB
testcase_04 AC 71 ms
71,156 KB
testcase_05 AC 71 ms
71,196 KB
testcase_06 AC 72 ms
71,160 KB
testcase_07 AC 71 ms
71,260 KB
testcase_08 AC 72 ms
71,192 KB
testcase_09 AC 72 ms
71,196 KB
testcase_10 AC 71 ms
71,144 KB
testcase_11 AC 71 ms
71,264 KB
testcase_12 AC 71 ms
71,252 KB
testcase_13 AC 69 ms
71,400 KB
testcase_14 AC 72 ms
71,160 KB
testcase_15 AC 72 ms
70,952 KB
testcase_16 AC 70 ms
71,072 KB
testcase_17 AC 70 ms
71,196 KB
testcase_18 AC 72 ms
71,228 KB
testcase_19 AC 73 ms
71,076 KB
testcase_20 AC 72 ms
71,268 KB
testcase_21 AC 170 ms
76,812 KB
testcase_22 AC 74 ms
70,944 KB
testcase_23 AC 105 ms
76,764 KB
testcase_24 AC 80 ms
76,372 KB
testcase_25 AC 137 ms
77,004 KB
testcase_26 AC 132 ms
77,304 KB
testcase_27 AC 93 ms
77,100 KB
testcase_28 AC 77 ms
75,776 KB
testcase_29 AC 85 ms
76,364 KB
testcase_30 AC 94 ms
77,280 KB
testcase_31 AC 95 ms
77,440 KB
testcase_32 AC 87 ms
76,704 KB
testcase_33 AC 95 ms
77,404 KB
testcase_34 AC 88 ms
76,672 KB
testcase_35 AC 89 ms
76,876 KB
testcase_36 AC 88 ms
76,684 KB
testcase_37 AC 94 ms
77,248 KB
testcase_38 AC 84 ms
76,552 KB
testcase_39 AC 85 ms
76,336 KB
testcase_40 AC 90 ms
76,788 KB
testcase_41 AC 86 ms
76,660 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N, M = map(int, input().split())
a = list(map(int, input().split()))
adj_list = [[] for _ in range(N)]

for _ in range(M):
    ui, vi = map(int, input().split())
    adj_list[ui-1].append(vi-1)
    adj_list[vi-1].append(ui-1)

for i in range(N):
    for j in range(len(adj_list[i])):
        for k in range(len(adj_list[i])):
            if j == k:
                continue
            l = [a[adj_list[i][j]], a[i], a[adj_list[i][k]]]
            
            if len(set(l)) == 3 and a[i] in [max(l), min(l)]:
                print('YES')
                exit()

print('NO')
0