結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,636 KB
testcase_01 AC 19 ms
8,636 KB
testcase_02 AC 18 ms
8,508 KB
testcase_03 AC 17 ms
8,476 KB
testcase_04 AC 18 ms
8,608 KB
testcase_05 AC 17 ms
8,488 KB
testcase_06 AC 17 ms
8,660 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 18 ms
8,652 KB
testcase_10 AC 18 ms
8,668 KB
testcase_11 AC 18 ms
8,664 KB
testcase_12 AC 18 ms
8,508 KB
testcase_13 AC 18 ms
8,508 KB
testcase_14 WA -
testcase_15 AC 18 ms
8,524 KB
testcase_16 AC 18 ms
8,580 KB
testcase_17 AC 18 ms
8,576 KB
testcase_18 AC 18 ms
8,652 KB
testcase_19 AC 18 ms
8,512 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 53 ms
17,472 KB
testcase_23 AC 508 ms
17,552 KB
testcase_24 AC 29 ms
8,964 KB
testcase_25 AC 327 ms
8,920 KB
testcase_26 AC 981 ms
9,032 KB
testcase_27 AC 130 ms
17,864 KB
testcase_28 WA -
testcase_29 AC 248 ms
17,592 KB
testcase_30 AC 63 ms
17,880 KB
testcase_31 AC 111 ms
17,960 KB
testcase_32 AC 97 ms
17,720 KB
testcase_33 WA -
testcase_34 AC 133 ms
17,744 KB
testcase_35 AC 119 ms
17,792 KB
testcase_36 AC 165 ms
17,788 KB
testcase_37 WA -
testcase_38 AC 133 ms
17,876 KB
testcase_39 AC 66 ms
17,772 KB
testcase_40 WA -
testcase_41 AC 176 ms
17,516 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 len(set([i, j, k])) == 3:
                    if a[i] < a[j] > a[k] and a[i] != a[k] or \
                        a[i] > a[j] < a[k] and a[i] != a[k]:
                            print('YES')
                            return
    print('NO')

main()
0