結果

問題 No.2510 Six Cube Sum Counting
コンテスト
ユーザー detteiuu
提出日時 2026-07-03 22:25:32
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
MLE  
実行時間 -
コード長 678 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 228 ms
コンパイル使用メモリ 85,504 KB
実行使用メモリ 893,552 KB
最終ジャッジ日時 2026-07-03 22:26:56
合計ジャッジ時間 76,429 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 MLE * 1
other AC * 6 MLE * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from collections import defaultdict

X = int(input())

half = X//2
half2 = X//2+X%2

A = []
for a in range(301):
    for b in range(a, 301):
        for c in range(b, 301):
            if a*a*a+b*b*b+c*c*c <= half:
                A.append((c, a*a*a+b*b*b+c*c*c))
B = []
for d in range(301):
    for e in range(d, 301):
        for f in range(e, 301):
            if half2 <= d*d*d+e*e*e+f*f*f <= X:
                B.append((d, d*d*d+e*e*e+f*f*f))

A.sort(key=lambda x:x[0])
B.sort(key=lambda x:x[0])
D = defaultdict(int)
idx = len(B)-1
ans = 0
for c, s in A[::-1]:
    while 0 <= idx and c <= B[idx][0]:
        D[B[idx][1]] += 1
        idx -= 1
    ans += D[X-s]

print(ans)
0