結果
問題 | No.1242 高橋君とすごろく |
ユーザー | 👑 rin204 |
提出日時 | 2022-07-06 21:45:37 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 77 ms / 2,000 ms |
コード長 | 1,091 bytes |
コンパイル時間 | 374 ms |
コンパイル使用メモリ | 87,248 KB |
実行使用メモリ | 71,528 KB |
最終ジャッジ日時 | 2023-08-24 21:24:32 |
合計ジャッジ時間 | 4,035 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 75 ms
71,220 KB |
testcase_01 | AC | 74 ms
71,416 KB |
testcase_02 | AC | 74 ms
71,308 KB |
testcase_03 | AC | 75 ms
71,072 KB |
testcase_04 | AC | 75 ms
71,216 KB |
testcase_05 | AC | 74 ms
71,476 KB |
testcase_06 | AC | 75 ms
71,068 KB |
testcase_07 | AC | 75 ms
71,304 KB |
testcase_08 | AC | 74 ms
71,308 KB |
testcase_09 | AC | 74 ms
71,216 KB |
testcase_10 | AC | 76 ms
71,220 KB |
testcase_11 | AC | 75 ms
71,296 KB |
testcase_12 | AC | 75 ms
71,160 KB |
testcase_13 | AC | 76 ms
71,412 KB |
testcase_14 | AC | 76 ms
71,528 KB |
testcase_15 | AC | 76 ms
71,328 KB |
testcase_16 | AC | 75 ms
71,324 KB |
testcase_17 | AC | 75 ms
71,520 KB |
testcase_18 | AC | 75 ms
71,404 KB |
testcase_19 | AC | 75 ms
71,500 KB |
testcase_20 | AC | 76 ms
71,332 KB |
testcase_21 | AC | 76 ms
71,316 KB |
testcase_22 | AC | 76 ms
71,300 KB |
testcase_23 | AC | 77 ms
71,420 KB |
testcase_24 | AC | 76 ms
71,472 KB |
testcase_25 | AC | 76 ms
71,520 KB |
testcase_26 | AC | 76 ms
71,408 KB |
testcase_27 | AC | 74 ms
71,472 KB |
ソースコード
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")