結果
問題 |
No.629 グラフの中に眠る門松列
|
ユーザー |
|
提出日時 | 2018-01-16 15:42:54 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 558 bytes |
コンパイル時間 | 118 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-12-24 04:39:25 |
合計ジャッジ時間 | 10,913 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 WA * 2 |
other | AC * 18 WA * 18 |
ソースコード
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[i]-1]): return True if check(): print("YES") else: print("NO")