結果
| 問題 | 
                            No.2246 1333-like Number
                             | 
                    
| コンテスト | |
| ユーザー | 
                             lam6er
                         | 
                    
| 提出日時 | 2025-03-20 18:52:34 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,031 bytes | 
| コンパイル時間 | 238 ms | 
| コンパイル使用メモリ | 82,596 KB | 
| 実行使用メモリ | 76,960 KB | 
| 最終ジャッジ日時 | 2025-03-20 18:53:34 | 
| 合計ジャッジ時間 | 4,237 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 1 TLE * 1 -- * 22 | 
ソースコード
import heapq
def main():
    N = int(input())
    heap = []
    
    # Generate all possible (a, b) pairs with a < b and push their initial values into the heap
    for a in range(1, 10):
        for b in range(a + 1, 10):
            initial_num = str(10 * a + b)
            num_tuple = (len(initial_num),) + tuple(map(int, initial_num))
            heapq.heappush(heap, (num_tuple, a, b, 0))
    
    current_count = 0
    result = ""
    while heap:
        num_tuple, a, b, c = heapq.heappop(heap)
        current_count += 1
        if current_count == N:
            # Convert the tuple back to the string representation
            result = ''.join(map(str, num_tuple[1:]))
            break
        # Generate the next number by appending b to the current number
        new_num_str = ''.join(map(str, num_tuple[1:])) + str(b)
        new_num_tuple = (len(new_num_str),) + tuple(map(int, new_num_str))
        heapq.heappush(heap, (new_num_tuple, a, b, c + 1))
    
    print(result)
if __name__ == "__main__":
    main()
            
            
            
        
            
lam6er