結果
問題 |
No.629 グラフの中に眠る門松列
|
ユーザー |
|
提出日時 | 2019-02-04 20:51:08 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 776 bytes |
コンパイル時間 | 197 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 22,656 KB |
最終ジャッジ日時 | 2024-12-26 00:27:00 |
合計ジャッジ時間 | 32,395 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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)