結果

問題 No.629 グラフの中に眠る門松列
ユーザー tamatotamato
提出日時 2020-05-12 20:33:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 89 ms / 4,000 ms
コード長 753 bytes
コンパイル時間 775 ms
コンパイル使用メモリ 87,632 KB
実行使用メモリ 76,480 KB
最終ジャッジ日時 2023-10-11 22:10:37
合計ジャッジ時間 6,176 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,672 KB
testcase_01 AC 74 ms
71,512 KB
testcase_02 AC 73 ms
71,548 KB
testcase_03 AC 73 ms
71,520 KB
testcase_04 AC 75 ms
71,400 KB
testcase_05 AC 74 ms
71,224 KB
testcase_06 AC 74 ms
71,372 KB
testcase_07 AC 75 ms
71,592 KB
testcase_08 AC 73 ms
71,716 KB
testcase_09 AC 74 ms
71,564 KB
testcase_10 AC 74 ms
71,372 KB
testcase_11 AC 74 ms
71,312 KB
testcase_12 AC 75 ms
71,560 KB
testcase_13 AC 73 ms
71,516 KB
testcase_14 AC 75 ms
71,632 KB
testcase_15 AC 71 ms
71,528 KB
testcase_16 AC 73 ms
71,772 KB
testcase_17 AC 74 ms
71,672 KB
testcase_18 AC 75 ms
71,212 KB
testcase_19 AC 75 ms
71,632 KB
testcase_20 AC 73 ms
71,556 KB
testcase_21 AC 80 ms
76,304 KB
testcase_22 AC 77 ms
71,736 KB
testcase_23 AC 77 ms
71,740 KB
testcase_24 AC 83 ms
76,092 KB
testcase_25 AC 84 ms
76,096 KB
testcase_26 AC 88 ms
76,388 KB
testcase_27 AC 87 ms
76,444 KB
testcase_28 AC 78 ms
71,440 KB
testcase_29 AC 83 ms
76,236 KB
testcase_30 AC 86 ms
76,472 KB
testcase_31 AC 87 ms
76,320 KB
testcase_32 AC 86 ms
76,348 KB
testcase_33 AC 89 ms
76,412 KB
testcase_34 AC 83 ms
76,036 KB
testcase_35 AC 84 ms
76,272 KB
testcase_36 AC 86 ms
76,232 KB
testcase_37 AC 86 ms
76,480 KB
testcase_38 AC 82 ms
76,048 KB
testcase_39 AC 83 ms
76,056 KB
testcase_40 AC 84 ms
76,456 KB
testcase_41 AC 82 ms
75,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.buffer.readline

    def fin():
        print("YES")
        exit()

    N, M = map(int, input().split())
    A = [0] + list(map(int, input().split()))
    adj = [[] for _ in range(N+1)]
    for _ in range(M):
        a, b = map(int, input().split())
        adj[a].append(b)
        adj[b].append(a)

    for v in range(1, N+1):
        a = A[v]
        small = set()
        large = set()
        for u in adj[v]:
            if A[u] < a:
                small.add(A[u])
            elif A[u] > a:
                large.add(A[u])
        if len(small) > 1 or len(large) > 1:
            fin()
            print(v)
    print("NO")


if __name__ == '__main__':
    main()
0