結果
| 問題 | No.629 グラフの中に眠る門松列 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-02-04 20:51:08 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
TLE
不安定
|
| 実行時間 | - |
| コード長 | 776 bytes |
| 記録 | |
| コンパイル時間 | 55 ms |
| コンパイル使用メモリ | 15,104 KB |
| 実行使用メモリ | 12,032 KB |
| 最終ジャッジ日時 | 2026-10-08 00:53:30 |
| 合計ジャッジ時間 | 27,230 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 33 TLE * 3 |
ソースコード
def isTrees(x1, x2, x3):
if x1 != x3 and ((x2 > x1 and x2 > x3) or (x2 < x1 and x2 < x3)):
return True
else:
return False
n,m = input().split(' ')
a = []
a = input().split(' ')
v = []
for i in range(0,int(m)):
v.append(input().split(' '))
result = 'NO'
for i in range(0,int(m)):
for j in range(0,int(m)):
if i != j:
if v[i][0] in v[j]:
t = 1 if(v[j].index(v[i][0]) == 0) else 0
if isTrees(a[int(v[j][t])-1], a[int(v[i][0])-1], a[int(v[i][1])-1]):
result = 'YES'
break
if v[i][1] in v[j]:
t = 1 if(v[j].index(v[i][1]) == 0) else 0
if isTrees(a[int(v[j][t])-1], a[int(v[i][1])-1], a[int(v[i][0])-1]):
result = 'YES'
break
if result == 'YES':
break
print(result)