結果
問題 |
No.2246 1333-like Number
|
ユーザー |
![]() |
提出日時 | 2025-04-16 16:02:47 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,050 ms / 2,000 ms |
コード長 | 695 bytes |
コンパイル時間 | 390 ms |
コンパイル使用メモリ | 81,892 KB |
実行使用メモリ | 76,196 KB |
最終ジャッジ日時 | 2025-04-16 16:09:25 |
合計ジャッジ時間 | 15,329 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
import heapq n = int(input()) # Generate all valid (a, b) pairs where a < b pairs = [] for a in range(1, 10): for b in range(a + 1, 10): pairs.append((a, b)) # Initialize the heap with the initial elements (c=0) heap = [] for a, b in pairs: heapq.heappush(heap, (2, a, b, 0)) # (length, a, b, c) current_step = 0 result = None while heap: length, a, b, c = heapq.heappop(heap) current_step += 1 if current_step == n: # Construct the result string result = str(a) + str(b) + str(b) * c break # Push the next element in this (a, b) sequence new_length = length + 1 heapq.heappush(heap, (new_length, a, b, c + 1)) print(result)