結果
| 問題 |
No.629 グラフの中に眠る門松列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-01-06 18:51:17 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 43 ms / 4,000 ms |
| コード長 | 568 bytes |
| コンパイル時間 | 239 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 11,136 KB |
| 最終ジャッジ日時 | 2024-12-23 08:45:51 |
| 合計ジャッジ時間 | 2,588 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 36 |
ソースコード
n, m = [int(x) for x in input().split()]
score = [int(x) for x in input().split()]
g = [[] for i in range(n)]
for i in range(m):
u, v = [int(x) for x in input().split()]
g[u - 1].append(v - 1)
g[v - 1].append(u - 1)
for i, v in enumerate(g):
tmp = [score[j] for j in v if score[i] < score[j]]
if len(tmp) >=2:
if len(set(tmp)) >=2:
print("YES")
exit()
tmp = [score[j] for j in v if score[i] > score[j]]
if len(tmp) >=2:
if len(set(tmp)) >=2:
print("YES")
exit()
print("NO")