結果

問題 No.629 グラフの中に眠る門松列
ユーザー GuestGuest
提出日時 2019-02-04 20:51:08
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 776 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 10,992 KB
実行使用メモリ 12,676 KB
最終ジャッジ日時 2023-08-26 21:34:07
合計ジャッジ時間 8,683 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
12,676 KB
testcase_01 AC 14 ms
7,956 KB
testcase_02 AC 12 ms
8,096 KB
testcase_03 AC 13 ms
7,792 KB
testcase_04 AC 13 ms
8,332 KB
testcase_05 AC 13 ms
7,788 KB
testcase_06 AC 13 ms
8,092 KB
testcase_07 AC 13 ms
8,288 KB
testcase_08 AC 14 ms
8,332 KB
testcase_09 AC 15 ms
8,280 KB
testcase_10 AC 13 ms
7,716 KB
testcase_11 AC 14 ms
8,148 KB
testcase_12 AC 14 ms
8,156 KB
testcase_13 AC 14 ms
8,352 KB
testcase_14 AC 14 ms
8,296 KB
testcase_15 AC 13 ms
8,156 KB
testcase_16 AC 14 ms
8,148 KB
testcase_17 AC 14 ms
8,328 KB
testcase_18 AC 13 ms
8,296 KB
testcase_19 AC 13 ms
8,208 KB
testcase_20 AC 13 ms
8,316 KB
testcase_21 AC 1,485 ms
8,632 KB
testcase_22 AC 16 ms
8,600 KB
testcase_23 AC 451 ms
8,336 KB
testcase_24 AC 41 ms
9,328 KB
testcase_25 TLE -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0