結果

問題 No.1242 高橋君とすごろく
ユーザー anagohirame
提出日時 2020-10-02 22:09:08
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 488 bytes
コンパイル時間 124 ms
コンパイル使用メモリ 82,484 KB
実行使用メモリ 250,528 KB
最終ジャッジ日時 2024-07-17 21:18:35
合計ジャッジ時間 4,135 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 6 TLE * 1 -- * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from heapq import heappush, heappop
n, k = map(int, input().split())
a = list(map(int, input().split()))
q = []
used = set()
for x in a:
	heappush(q, -x)
	used.add(x)
while q:
	l = -heappop(q)
	if l == 1:
		print("No")
		sys.exit()
	ret = []
	for _ in range(3):
		if not q:
			continue
		m = -heappop(q)
		ret.append(-m)
		if l - m in {1, 3, 5}:
			p = (l+m)//2 - 3
			if p not in used and p > 0:
				heappush(q, -p)
				used.add(p)
	for r in ret:
		heappush(q, r)
print("Yes")
0