結果

問題 No.629 グラフの中に眠る門松列
ユーザー kohei2019kohei2019
提出日時 2022-02-16 22:45:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 115 ms / 4,000 ms
コード長 561 bytes
コンパイル時間 366 ms
コンパイル使用メモリ 86,540 KB
実行使用メモリ 77,428 KB
最終ジャッジ日時 2023-09-11 17:17:10
合計ジャッジ時間 6,460 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
70,992 KB
testcase_01 AC 72 ms
71,096 KB
testcase_02 AC 72 ms
71,336 KB
testcase_03 AC 72 ms
71,388 KB
testcase_04 AC 72 ms
71,384 KB
testcase_05 AC 71 ms
71,284 KB
testcase_06 AC 71 ms
71,188 KB
testcase_07 AC 72 ms
71,100 KB
testcase_08 AC 70 ms
71,144 KB
testcase_09 AC 70 ms
71,136 KB
testcase_10 AC 73 ms
71,312 KB
testcase_11 AC 71 ms
71,268 KB
testcase_12 AC 71 ms
71,080 KB
testcase_13 AC 70 ms
71,144 KB
testcase_14 AC 70 ms
71,152 KB
testcase_15 AC 71 ms
71,132 KB
testcase_16 AC 72 ms
71,192 KB
testcase_17 AC 70 ms
71,320 KB
testcase_18 AC 71 ms
70,880 KB
testcase_19 AC 73 ms
71,112 KB
testcase_20 AC 71 ms
71,256 KB
testcase_21 AC 100 ms
76,140 KB
testcase_22 AC 82 ms
75,080 KB
testcase_23 AC 90 ms
76,068 KB
testcase_24 AC 93 ms
76,776 KB
testcase_25 AC 115 ms
77,392 KB
testcase_26 AC 107 ms
77,276 KB
testcase_27 AC 101 ms
76,624 KB
testcase_28 AC 80 ms
75,332 KB
testcase_29 AC 100 ms
76,984 KB
testcase_30 AC 100 ms
76,732 KB
testcase_31 AC 103 ms
77,396 KB
testcase_32 AC 97 ms
76,424 KB
testcase_33 AC 105 ms
77,296 KB
testcase_34 AC 98 ms
76,812 KB
testcase_35 AC 94 ms
76,648 KB
testcase_36 AC 105 ms
77,308 KB
testcase_37 AC 107 ms
77,428 KB
testcase_38 AC 101 ms
76,756 KB
testcase_39 AC 96 ms
76,592 KB
testcase_40 AC 100 ms
76,832 KB
testcase_41 AC 99 ms
76,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
lsa = list(map(int,input().split()))
lsg = [[] for i in range(N)]
for i in range(M):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    lsg[a].append(b)
    lsg[b].append(a)

for st in range(N):
    sta = lsa[st]
    for n1 in lsg[st]:
        for n2 in lsg[n1]:
            if sta < lsa[n1] and lsa[n1] > lsa[n2] and sta != lsa[n2]:
                print('YES')
                exit()
            if sta > lsa[n1] and lsa[n1] < lsa[n2] and sta != lsa[n2]:
                print('YES')
                exit()
print('NO')
0