結果

問題 No.629 グラフの中に眠る門松列
ユーザー GuestGuest
提出日時 2019-02-03 22:20:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 744 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 10,780 KB
実行使用メモリ 9,292 KB
最終ジャッジ日時 2023-08-23 12:57:25
合計ジャッジ時間 9,809 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,008 KB
testcase_01 AC 15 ms
7,956 KB
testcase_02 AC 15 ms
7,992 KB
testcase_03 AC 15 ms
8,124 KB
testcase_04 AC 15 ms
8,032 KB
testcase_05 AC 16 ms
8,032 KB
testcase_06 AC 16 ms
8,152 KB
testcase_07 AC 15 ms
7,984 KB
testcase_08 AC 14 ms
7,996 KB
testcase_09 AC 14 ms
7,920 KB
testcase_10 AC 15 ms
8,056 KB
testcase_11 AC 15 ms
8,004 KB
testcase_12 AC 15 ms
8,056 KB
testcase_13 AC 14 ms
8,056 KB
testcase_14 AC 14 ms
7,996 KB
testcase_15 AC 15 ms
7,988 KB
testcase_16 AC 14 ms
7,748 KB
testcase_17 AC 14 ms
8,060 KB
testcase_18 AC 16 ms
8,120 KB
testcase_19 AC 14 ms
7,952 KB
testcase_20 AC 15 ms
7,952 KB
testcase_21 AC 1,603 ms
8,308 KB
testcase_22 AC 19 ms
8,232 KB
testcase_23 AC 506 ms
8,164 KB
testcase_24 AC 43 ms
9,292 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'
      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'
  if result == 'YES':
    break

print(result)
0