結果
問題 | No.1242 高橋君とすごろく |
ユーザー |
![]() |
提出日時 | 2020-10-02 22:16:49 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,054 bytes |
コンパイル時間 | 212 ms |
コンパイル使用メモリ | 82,428 KB |
実行使用メモリ | 502,280 KB |
最終ジャッジ日時 | 2024-07-17 21:33:40 |
合計ジャッジ時間 | 4,297 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 6 TLE * 1 -- * 17 |
ソースコード
mod = 1000000007 eps = 10**-9 def main(): import sys from heapq import heappop, heappush, heapify input = sys.stdin.readline N, K = map(int, input().split()) A = list(map(int, input().split())) B = [-a for a in A] S = {a for a in A} heapify(B) flg = 1 b_prev = 10**20 cnt = 0 while B: b = -heappop(B) if b == b_prev - 1: cnt += 1 else: cnt = 0 if cnt == 6: flg = 0 break if b == 1: flg = 0 break elif b <= 0: break if b - 1 in S: if b-4 not in S: S.add(b - 4) heappush(B, -(b-4)) if b - 3 in S: if b-5 not in S: S.add(b - 5) heappush(B, -(b-5)) if b - 5 in S: if b-6 not in S: S.add(b - 6) heappush(B, -(b-6)) if flg: print("Yes") else: print("No") if __name__ == '__main__': main()