結果

問題 No.629 グラフの中に眠る門松列
ユーザー KozumaKozuma
提出日時 2018-01-17 00:16:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 573 bytes
コンパイル時間 703 ms
コンパイル使用メモリ 10,884 KB
実行使用メモリ 8,612 KB
最終ジャッジ日時 2023-08-25 19:55:33
合計ジャッジ時間 7,232 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,784 KB
testcase_01 AC 15 ms
7,760 KB
testcase_02 AC 16 ms
7,832 KB
testcase_03 AC 16 ms
7,760 KB
testcase_04 WA -
testcase_05 AC 16 ms
7,924 KB
testcase_06 AC 16 ms
7,784 KB
testcase_07 AC 15 ms
7,860 KB
testcase_08 AC 15 ms
7,848 KB
testcase_09 AC 16 ms
7,796 KB
testcase_10 AC 16 ms
7,832 KB
testcase_11 AC 16 ms
7,928 KB
testcase_12 AC 15 ms
7,784 KB
testcase_13 WA -
testcase_14 AC 16 ms
7,948 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 16 ms
7,764 KB
testcase_21 AC 52 ms
8,288 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 37 ms
8,332 KB
testcase_25 AC 559 ms
8,276 KB
testcase_26 AC 578 ms
8,284 KB
testcase_27 AC 320 ms
8,408 KB
testcase_28 AC 22 ms
7,888 KB
testcase_29 AC 35 ms
8,332 KB
testcase_30 AC 422 ms
8,508 KB
testcase_31 AC 53 ms
8,448 KB
testcase_32 AC 43 ms
8,380 KB
testcase_33 AC 559 ms
8,560 KB
testcase_34 AC 56 ms
8,360 KB
testcase_35 AC 185 ms
8,400 KB
testcase_36 AC 271 ms
8,532 KB
testcase_37 AC 279 ms
8,480 KB
testcase_38 WA -
testcase_39 AC 70 ms
8,480 KB
testcase_40 AC 103 ms
8,220 KB
testcase_41 AC 25 ms
8,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def kadomatu(x, y, z):
	if x != y and y != z and z != x:
		if (y < x and y < z) or (y > x and y > z):
			return True

def check():
	N, M = map(int, input().split())
	a = list(map(int, input().split()))
	u = [0] * M
	v = [0] * M

	for i in range(M):
		u[i], v[i] = map(int, input().split())

	for i in range(M):
		for j in range(i + 1, M):
			if u[j] == v[i]:
				if kadomatu(a[u[i]-1], a[v[i]-1], a[v[j]-1]):
					return True
			if v[j] == v[i]:
				if kadomatu(a[u[i]-1], a[v[i]-1], a[u[j]-1]):
					return True

	return False

if check():
	print("YES")
else:
	print("NO")
0