結果

問題 No.2198 Concon Substrings (COuNt-CONstruct Version)
ユーザー Navier_Boltzmann
提出日時 2023-01-27 23:19:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,104 bytes
コンパイル時間 226 ms
コンパイル使用メモリ 82,196 KB
実行使用メモリ 71,736 KB
最終ジャッジ日時 2024-06-28 08:09:15
合計ジャッジ時間 13,607 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 88 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline

M = int(input())

def fcr(n):
    
    ng = math.ceil(n**(1/3)) + 100
    
    ok = math.ceil(n**(1/3)) - 100
    while ng-ok>1:
        mid = (ng+ok)//2
        
        if mid**3<=n:
            ok = mid
        else:
            ng = mid
    return ok
if M <= 10**6:
    N = fcr(M)
    delta = M - N**3
    if N**3+N > M:
        N -= 1
    
    Y = N-1
    Z = N
    W = N
    X = M - N**3 - N
    ans = ['c','o'] + ['n']*X + ['c']*Y + ['o']*Z + ['n']*W
    print(''.join(ans))
    exit()
    
N = fcr(M)
for k in range(-1,2):
    W = N + k
    flg = False
    for i in range(-1000,1000):
        Z = N+i
        for j in range(-1000,1000):
            Y = N+j
            if (1< M - W*((Y+1)*Z+1) + W + Y + Z<=59998)&(M >= W*((Y+1)*Z+1)):
                flg = True
                break
        if flg:
            break
    if flg:
        break

    
    
    
X = M - W*(Z*(Y+1)+1)
ans = ['c','o'] + ['n']*X + ['c']*Y + ['o']*Z + ['n']*W
print(''.join(ans))
0