結果

問題 No.3331 Consecutive Cubic Sum
コンテスト
ユーザー urunea
提出日時 2025-11-05 04:02:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,365 ms / 5,000 ms
コード長 393 bytes
コンパイル時間 478 ms
コンパイル使用メモリ 82,160 KB
実行使用メモリ 219,588 KB
最終ジャッジ日時 2025-11-05 04:04:05
合計ジャッジ時間 65,956 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 47
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

N=int(input())
if N == 1:
    print(1)
    print(1, 1)
    exit()
mem=[1]

ans=[]
for i in range(2, 10**6+1):
    mem.append(mem[-1]+i*i*i)
    if mem[-1] == N:
        ans.append([1, i])
    idx = bisect.bisect_left(mem, mem[-1]-N)
    if idx < len(mem) and mem[idx] == mem[-1]-N:
        ans.append([idx+2, i])

ans=sorted(ans)
print(len(ans))
for L, R in ans:
    print(L, R)
0