結果

問題 No.600 かい文回
ユーザー vwxyzvwxyz
提出日時 2022-08-08 16:25:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 1,481 bytes
コンパイル時間 236 ms
コンパイル使用メモリ 12,124 KB
実行使用メモリ 11,292 KB
最終ジャッジ日時 2023-10-19 05:56:22
合計ジャッジ時間 2,367 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
11,292 KB
testcase_01 AC 39 ms
11,292 KB
testcase_02 AC 40 ms
11,292 KB
testcase_03 AC 41 ms
11,292 KB
testcase_04 AC 39 ms
11,292 KB
testcase_05 AC 39 ms
11,292 KB
testcase_06 AC 39 ms
11,292 KB
testcase_07 AC 41 ms
11,292 KB
testcase_08 AC 41 ms
11,292 KB
testcase_09 AC 40 ms
11,292 KB
testcase_10 AC 40 ms
11,292 KB
testcase_11 AC 40 ms
11,292 KB
testcase_12 AC 40 ms
11,292 KB
testcase_13 AC 39 ms
11,292 KB
testcase_14 AC 40 ms
11,292 KB
testcase_15 AC 40 ms
11,292 KB
testcase_16 AC 41 ms
11,292 KB
testcase_17 AC 40 ms
11,292 KB
testcase_18 AC 40 ms
11,292 KB
testcase_19 AC 40 ms
11,292 KB
testcase_20 AC 40 ms
11,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import copy
import decimal
import fractions
import heapq
import itertools
import math
import random
import sys
import time
from collections import Counter,deque,defaultdict
from functools import lru_cache,reduce
from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max
def _heappush_max(heap,item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappushpop_max(heap, item):
    if heap and item < heap[0]:
        item, heap[0] = heap[0], item
        heapq._siftup_max(heap, 0)
    return item
from math import gcd as GCD
read=sys.stdin.read
readline=sys.stdin.readline
readlines=sys.stdin.readlines

def check(S):
    N=len(S)
    ans=0
    for bit in range(1<<N//2):
        bound=[0]+[i+1 for i in range(N-1) if bit&1<<i]
        if N%2:
            bound+=[N-i for i in bound[::-1]]
        elif N//2==bound[-1]:
            bound+=[N-i for i in bound[:-1][::-1]]
        else:
            bound+=[N-i for i in bound[::-1]]
        le=len(bound)
        lst=[S[bound[i]:bound[i+1]] for i in range(le-1)]
        if lst==lst[::-1]:
            ans+=1
    return ans

alp=[chr(i) for i in range(97,97+26)]
lst=[a+b for a in alp[:3] for b in alp[3:7]]+alp[7:]
def main(N):
    if N==1:
        return lst.pop()
    if N==2:
        return lst.pop()*2
    n=0
    while N>=3 and N%2==0:
        N//=2
        n+=1
    N-=1
    S=lst.pop()
    return S*(n+1)+main(N)+S*(n+1)

N=int(readline())
ans=main(N)
print(ans)
0