結果
| 問題 |
No.1242 高橋君とすごろく
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-07-06 21:45:37 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 48 ms / 2,000 ms |
| コード長 | 1,091 bytes |
| コンパイル時間 | 511 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 52,864 KB |
| 最終ジャッジ日時 | 2024-12-23 07:27:54 |
| 合計ジャッジ時間 | 3,085 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 24 |
ソースコード
from heapq import *
n, k = map(int, input().split())
A = list(map(int, input().split()))
hq = [-a for a in A[::-1]]
se = set(A)
row = 0
bef = 1 << 60
while hq:
a = -heappop(hq)
if a == 1:
print("No")
exit()
if a <= 0:
break
if a == bef - 1:
row += 1
if row == 6:
print("No")
exit()
else:
row = 1
bef = a
if a - 1 in se:
x = a - 4
if x not in se:
se.add(x)
heappush(hq, -x)
if a - 3 in se:
x = a - 5
if x not in se:
se.add(x)
heappush(hq, -x)
if a - 5 in se:
x = a - 6
if x not in se:
se.add(x)
heappush(hq, -x)
if a + 1 in se:
x = a - 3
if x not in se:
se.add(x)
heappush(hq, -x)
if a + 3 in se:
x = a - 2
if x not in se:
se.add(x)
heappush(hq, -x)
if a + 5 in se:
x = a - 1
if x not in se:
se.add(x)
heappush(hq, -x)
print("Yes")