結果

問題 No.629 グラフの中に眠る門松列
ユーザー ssmkzkssmkzk
提出日時 2019-06-26 17:11:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 633 bytes
コンパイル時間 131 ms
コンパイル使用メモリ 10,856 KB
実行使用メモリ 8,652 KB
最終ジャッジ日時 2023-09-07 11:40:20
合計ジャッジ時間 3,053 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,040 KB
testcase_01 RE -
testcase_02 AC 16 ms
8,016 KB
testcase_03 AC 15 ms
8,184 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 16 ms
7,684 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 16 ms
8,020 KB
testcase_11 AC 16 ms
8,188 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 16 ms
7,828 KB
testcase_15 AC 15 ms
8,068 KB
testcase_16 AC 16 ms
8,180 KB
testcase_17 AC 16 ms
8,196 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 AC 29 ms
8,652 KB
testcase_25 AC 31 ms
8,476 KB
testcase_26 AC 31 ms
8,560 KB
testcase_27 AC 30 ms
8,444 KB
testcase_28 RE -
testcase_29 AC 25 ms
8,324 KB
testcase_30 AC 30 ms
8,564 KB
testcase_31 AC 30 ms
8,432 KB
testcase_32 AC 29 ms
8,440 KB
testcase_33 AC 32 ms
8,620 KB
testcase_34 AC 26 ms
8,464 KB
testcase_35 AC 26 ms
8,480 KB
testcase_36 AC 29 ms
8,540 KB
testcase_37 AC 27 ms
8,500 KB
testcase_38 AC 29 ms
8,488 KB
testcase_39 AC 25 ms
8,308 KB
testcase_40 AC 22 ms
8,228 KB
testcase_41 AC 21 ms
8,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

N, M = map(int, input().split())
l = list(map(int, input().split())) 
conect_l = [[] for i in range(M)]

for i in range(M):
    node1, node2 = map(int, input().split())
    conect_l[node1 - 1].append(l[node1 - 1] - l[node2 - 1])
    conect_l[node2 - 1].append(l[node2 - 1] - l[node1 - 1])

for i in range(M):
    s = set(conect_l[i])
    ck = list(s)
    posi_n = 0
    nega_n = 0
    for l_i in ck:
        if l_i > 0:
            posi_n += 1
        if l_i < 0:
            nega_n += 1
    if posi_n >= 2:
        print("YES")
        sys.exit()
    if nega_n >= 2:
        print("YES")
        sys.exit()

print("NO")
0