結果

問題 No.2246 1333-like Number
ユーザー lam6er
提出日時 2025-04-15 23:10:22
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 472 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 82,220 KB
実行使用メモリ 269,012 KB
最終ジャッジ日時 2025-04-15 23:12:48
合計ジャッジ時間 3,933 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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