結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,828 KB
testcase_01 AC 16 ms
7,816 KB
testcase_02 AC 15 ms
7,868 KB
testcase_03 AC 15 ms
7,812 KB
testcase_04 WA -
testcase_05 AC 15 ms
7,836 KB
testcase_06 AC 14 ms
7,800 KB
testcase_07 AC 15 ms
7,808 KB
testcase_08 AC 14 ms
7,812 KB
testcase_09 AC 15 ms
7,752 KB
testcase_10 AC 15 ms
7,904 KB
testcase_11 AC 15 ms
7,924 KB
testcase_12 AC 14 ms
7,812 KB
testcase_13 WA -
testcase_14 AC 14 ms
7,840 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 15 ms
7,916 KB
testcase_21 AC 51 ms
8,252 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 37 ms
8,348 KB
testcase_25 AC 570 ms
8,256 KB
testcase_26 AC 580 ms
8,388 KB
testcase_27 AC 319 ms
8,596 KB
testcase_28 AC 21 ms
7,920 KB
testcase_29 AC 36 ms
8,412 KB
testcase_30 AC 424 ms
8,404 KB
testcase_31 AC 53 ms
8,420 KB
testcase_32 AC 42 ms
8,424 KB
testcase_33 AC 561 ms
8,520 KB
testcase_34 AC 57 ms
8,500 KB
testcase_35 AC 186 ms
8,432 KB
testcase_36 AC 273 ms
8,608 KB
testcase_37 AC 279 ms
8,380 KB
testcase_38 WA -
testcase_39 AC 71 ms
8,280 KB
testcase_40 AC 102 ms
8,256 KB
testcase_41 AC 25 ms
8,264 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