結果
問題 |
No.629 グラフの中に眠る門松列
|
ユーザー |
|
提出日時 | 2018-01-17 00:16:22 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 573 bytes |
コンパイル時間 | 221 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-12-24 05:56:30 |
合計ジャッジ時間 | 8,485 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 WA * 1 |
other | AC * 27 WA * 9 |
ソースコード
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[j]-1]): return True return False if check(): print("YES") else: print("NO")