結果

問題 No.2198 Concon Substrings (COuNt-CONstruct Version)
ユーザー gew1fw
提出日時 2025-06-12 20:24:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 701 bytes
コンパイル時間 230 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 52,480 KB
最終ジャッジ日時 2025-06-12 20:24:28
合計ジャッジ時間 20,222 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 1 WA * 103
権限があれば一括ダウンロードができます

ソースコード

diff #

def find_k(M):
    low = 1
    high = int((6 * M) ** (1/3)) + 2  # Upper bound for cube root of 6*M
    while low <= high:
        mid = (low + high) // 2
        value = mid * (mid + 1) * (mid + 2) // 6
        if value == M:
            return mid
        elif value < M:
            low = mid + 1
        else:
            high = mid - 1
    return -1  # If not found, though problem says solution exists

M = int(input())
if M == 0:
    print("kudamakitsukasa")
else:
    k = find_k(M)
    if k != -1:
        print("con" * k)
    else:
        # If k not found, find a, b, c such that a*b*c = M and a + b + c <= 60000
        # This part is a fallback but not tested here
        print("con" * k)
0