結果

問題 No.629 グラフの中に眠る門松列
ユーザー GrayCoderGrayCoder
提出日時 2018-01-05 23:13:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 768 bytes
コンパイル時間 666 ms
コンパイル使用メモリ 10,868 KB
実行使用メモリ 17,980 KB
最終ジャッジ日時 2023-08-24 21:16:15
合計ジャッジ時間 3,747 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,520 KB
testcase_01 AC 19 ms
8,660 KB
testcase_02 AC 19 ms
8,604 KB
testcase_03 AC 19 ms
8,448 KB
testcase_04 AC 19 ms
8,436 KB
testcase_05 AC 19 ms
8,584 KB
testcase_06 AC 19 ms
8,632 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 19 ms
8,592 KB
testcase_10 AC 19 ms
8,632 KB
testcase_11 AC 18 ms
8,516 KB
testcase_12 AC 18 ms
8,644 KB
testcase_13 AC 19 ms
8,568 KB
testcase_14 WA -
testcase_15 AC 19 ms
8,616 KB
testcase_16 AC 19 ms
8,576 KB
testcase_17 AC 19 ms
8,580 KB
testcase_18 AC 19 ms
8,580 KB
testcase_19 AC 18 ms
8,676 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 53 ms
17,420 KB
testcase_23 AC 132 ms
17,416 KB
testcase_24 AC 29 ms
8,940 KB
testcase_25 AC 79 ms
8,952 KB
testcase_26 AC 318 ms
8,944 KB
testcase_27 AC 77 ms
17,868 KB
testcase_28 WA -
testcase_29 AC 94 ms
17,800 KB
testcase_30 AC 61 ms
17,792 KB
testcase_31 AC 71 ms
17,796 KB
testcase_32 AC 68 ms
17,888 KB
testcase_33 WA -
testcase_34 AC 74 ms
17,660 KB
testcase_35 AC 71 ms
17,652 KB
testcase_36 AC 79 ms
17,728 KB
testcase_37 WA -
testcase_38 AC 74 ms
17,740 KB
testcase_39 AC 61 ms
17,616 KB
testcase_40 WA -
testcase_41 AC 78 ms
17,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
from collections import defaultdict
from collections import Counter
from itertools import permutations

def main():
    N, M = map(int, input().split())
    A = tuple(map(int, input().split()))
    UV = tuple(tuple(map(int, input().split())) for _ in [0] * M)

    a = dict()
    for i, j in enumerate(A):
        a[i+1] = j

    edge = [[0 for _ in [0] * (N + 1)] for _ in [0] * (N + 1)]
    for u, v in UV:
        edge[u][v] = edge[v][u] = 1

    for i in range(1, N + 1):
        for j in range(1, N + 1):
            for k in range(1, N + 1):
                if a[i] != a[k]:
                    if a[i] < a[j] > a[k] or a[i] > a[j] < a[k]:
                        print('YES')
                        return
    print('NO')

main()
0