結果

問題 No.629 グラフの中に眠る門松列
ユーザー toyuzukotoyuzuko
提出日時 2020-08-16 22:35:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 70 ms / 4,000 ms
コード長 482 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 71,552 KB
最終ジャッジ日時 2024-04-19 18:34:49
合計ジャッジ時間 3,273 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
51,840 KB
testcase_01 AC 34 ms
51,840 KB
testcase_02 AC 35 ms
51,840 KB
testcase_03 AC 33 ms
52,352 KB
testcase_04 AC 33 ms
51,712 KB
testcase_05 AC 32 ms
51,840 KB
testcase_06 AC 34 ms
51,328 KB
testcase_07 AC 33 ms
51,584 KB
testcase_08 AC 33 ms
51,840 KB
testcase_09 AC 34 ms
52,096 KB
testcase_10 AC 34 ms
52,224 KB
testcase_11 AC 32 ms
52,096 KB
testcase_12 AC 32 ms
51,328 KB
testcase_13 AC 32 ms
51,712 KB
testcase_14 AC 32 ms
51,840 KB
testcase_15 AC 35 ms
52,096 KB
testcase_16 AC 35 ms
52,224 KB
testcase_17 AC 33 ms
52,352 KB
testcase_18 AC 34 ms
51,584 KB
testcase_19 AC 34 ms
52,224 KB
testcase_20 AC 33 ms
51,584 KB
testcase_21 AC 53 ms
64,512 KB
testcase_22 AC 46 ms
61,568 KB
testcase_23 AC 45 ms
62,080 KB
testcase_24 AC 55 ms
69,504 KB
testcase_25 AC 57 ms
70,528 KB
testcase_26 AC 60 ms
71,552 KB
testcase_27 AC 60 ms
71,296 KB
testcase_28 AC 39 ms
54,912 KB
testcase_29 AC 55 ms
69,120 KB
testcase_30 AC 61 ms
71,296 KB
testcase_31 AC 62 ms
70,784 KB
testcase_32 AC 57 ms
69,632 KB
testcase_33 AC 62 ms
71,552 KB
testcase_34 AC 57 ms
69,760 KB
testcase_35 AC 57 ms
68,608 KB
testcase_36 AC 56 ms
69,504 KB
testcase_37 AC 60 ms
70,912 KB
testcase_38 AC 58 ms
69,888 KB
testcase_39 AC 70 ms
69,376 KB
testcase_40 AC 66 ms
70,144 KB
testcase_41 AC 65 ms
68,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
A = list(map(int, input().split()))

graph = [[] for _ in range(N)]

for _ in range(M):
    u, v = map(int, input().split())
    graph[u - 1].append(v - 1)
    graph[v - 1].append(u - 1)

for i in range(N):
    lo = set()
    hi = set()
    for j in graph[i]:
        if A[i] < A[j]:
            hi.add(A[j])
        if A[i] > A[j]:
            lo.add(A[j])
    if len(hi) > 1 or len(lo) > 1:
        print('YES')
        break
else:
    print('NO')
0