結果

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

ソースコード

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,2,3,5,6]],
      [[1,2,3,5]],
      [[0,1,3,5,6]],
      [[0,1,3,4,5,6],[1,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
                if max(x)-min(x)>=5:
                    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**60):
    if calc(str(i))==True:
        print(i)
        break

        
0