結果

問題 No.629 グラフの中に眠る門松列
ユーザー FukumotoFukumoto
提出日時 2020-06-08 12:05:33
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 523 bytes
コンパイル時間 84 ms
コンパイル使用メモリ 10,780 KB
実行使用メモリ 8,632 KB
最終ジャッジ日時 2023-08-26 07:02:03
合計ジャッジ時間 2,883 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,188 KB
testcase_01 AC 16 ms
7,856 KB
testcase_02 AC 15 ms
8,244 KB
testcase_03 AC 15 ms
8,196 KB
testcase_04 AC 14 ms
8,136 KB
testcase_05 AC 14 ms
8,252 KB
testcase_06 AC 15 ms
7,824 KB
testcase_07 AC 15 ms
7,884 KB
testcase_08 AC 13 ms
7,912 KB
testcase_09 AC 16 ms
8,168 KB
testcase_10 AC 15 ms
8,188 KB
testcase_11 AC 14 ms
8,284 KB
testcase_12 AC 14 ms
8,144 KB
testcase_13 AC 15 ms
8,188 KB
testcase_14 WA -
testcase_15 AC 14 ms
8,248 KB
testcase_16 AC 14 ms
8,272 KB
testcase_17 AC 15 ms
8,240 KB
testcase_18 AC 15 ms
8,140 KB
testcase_19 AC 14 ms
8,312 KB
testcase_20 AC 14 ms
7,912 KB
testcase_21 AC 53 ms
8,376 KB
testcase_22 AC 18 ms
8,428 KB
testcase_23 AC 17 ms
8,504 KB
testcase_24 AC 24 ms
8,420 KB
testcase_25 WA -
testcase_26 AC 47 ms
8,316 KB
testcase_27 AC 25 ms
8,560 KB
testcase_28 WA -
testcase_29 AC 22 ms
8,484 KB
testcase_30 AC 26 ms
8,480 KB
testcase_31 AC 26 ms
8,632 KB
testcase_32 AC 27 ms
8,524 KB
testcase_33 WA -
testcase_34 AC 22 ms
8,504 KB
testcase_35 AC 22 ms
8,456 KB
testcase_36 AC 25 ms
8,564 KB
testcase_37 WA -
testcase_38 AC 25 ms
8,560 KB
testcase_39 AC 22 ms
8,480 KB
testcase_40 WA -
testcase_41 AC 18 ms
8,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

N, M = list(map(int, input().split()))
a = list(map(int, input().split()))
g = [[] for i in range(N)]
for i in range(M):
    u, v = list(map(int, input().split()))
    u -= 1; v -= 1
    
    g[u].append(v)
    g[v].append(u)
    
for i in range(N):
    q = [v for v in g[i]]

    for v in q:
        n = [(a[i], a[v], a[u]) for u in g[v] if a[i] != a[u] and a[v] != a[u]]
        for s in n:
            if min(s) == a[v] or max(s) == a[v]: 
                print('YES')
                sys.exit()

print('NO')
0