結果

問題 No.3408 1215 Segments
コンテスト
ユーザー titia
提出日時 2025-12-15 04:14:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,123 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 334 ms
コンパイル使用メモリ 82,612 KB
実行使用メモリ 86,088 KB
最終ジャッジ日時 2025-12-15 04:14:17
合計ジャッジ時間 7,899 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 6 WA * 10 TLE * 1 -- * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
input = sys.stdin.readline

LIST=[[[0,1,2,4,5,6],[3,4,5,6]],
      [[2,5],[1,4]],
      [[0,2,3,4,6]],
      [[0,1,2,3,5]],
      [[1,2,3,5]],
      [[0,1,3,5,6]],
      [[0,1,3,4,5,6],[1,2,3,4,5,6]],
      [[0,2,5],[0,1,2,5]],
      [[]],
      [[0,1,2,3,5,6],[0,1,2,3,5]]
      ]

def calc(S):
    NOW=[[0]*7]
    NNOW=[]

    for now in NOW:
        now2=[now]
        for s in S:
            #print(s)
            now3=[]
            for nowl in now2:
                #print(nowl)
                
                for ll in LIST[int(s)]:
                    ni=nowl[:]
                    for x in ll:
                        ni[x]+=1
                    now3.append(ni[:])

            now3.sort()
            now2=[]
            for x in now3:
                if now2 and now2[-1]==x:
                    continue
                now2.append(x)
            #print(now2)
        NNOW+=now2

    #print(NNOW)

    for x in NNOW:
        if len(set(x))==1:
            return True
    return False


N=int(input())

for i in range(N,10**18+20):
    if calc(str(i))==True:
        print(i)
        break

    
0