結果

問題 No.2246 1333-like Number
ユーザー lam6er
提出日時 2025-04-16 15:59:40
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 472 bytes
コンパイル時間 424 ms
コンパイル使用メモリ 81,868 KB
実行使用メモリ 66,792 KB
最終ジャッジ日時 2025-04-16 16:02:14
合計ジャッジ時間 4,736 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 1 TLE * 1 -- * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq

n = int(input())

heap = []
# Generate all possible (a, b) pairs and their initial numbers
for a in range(1, 10):
    for b in range(a + 1, 10):
        num_str = f"{a}{b}"
        heapq.heappush(heap, (len(num_str), num_str, a, b))

current = None
for _ in range(n):
    current = heapq.heappop(heap)
    length, num_str, a, b = current
    next_num_str = num_str + str(b)
    heapq.heappush(heap, (len(next_num_str), next_num_str, a, b))

print(current[1])
0