結果

問題 No.3331 Consecutive Cubic Sum
コンテスト
ユーザー wasd314
提出日時 2025-10-24 01:16:31
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 647 ms / 5,000 ms
+ 248µs
コード長 374 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 244 ms
コンパイル使用メモリ 95,724 KB
実行使用メモリ 319,108 KB
最終ジャッジ日時 2026-07-16 06:03:40
合計ジャッジ時間 16,917 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 47
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n = int(input())

# floor(n^{1/3}) + 1
m = next(i for i in range(n + 2) if i**3 > n)
assert (m - 1)**3 <= n < m**3

b = [i * i * (i + 1) * (i + 1) // 4 for i in range(m)]
to_i = {bi: i for i, bi in enumerate(b)}

ans = []
for l in range(1, m):
    r = to_i.get(b[l - 1] + n)
    if r is not None:
        ans.append((l, r))

print(len(ans))
for l, r in ans:
    print(l, r)
0