結果
| 問題 | No.2510 Six Cube Sum Counting |
| コンテスト | |
| ユーザー |
detteiuu
|
| 提出日時 | 2026-07-03 22:38:16 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 956 bytes |
| 記録 | |
| コンパイル時間 | 469 ms |
| コンパイル使用メモリ | 85,376 KB |
| 実行使用メモリ | 516,840 KB |
| 最終ジャッジ日時 | 2026-07-03 22:40:15 |
| 合計ジャッジ時間 | 29,585 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 25 MLE * 1 |
ソースコード
from collections import defaultdict
X = int(input())
half = X//2
half2 = X//2+X%2
A = []
cntC = [0]*301
for c in range(301):
for b in range(c+1):
for a in range(b+1):
if a*a*a+b*b*b+c*c*c <= half:
A.append(a*a*a+b*b*b+c*c*c)
cntC[c] += 1
B = []
cntD = [0]*301
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+e*e*e+f*f*f)
cntD[d] += 1
D = defaultdict(int)
idx = len(B)-1
idxA = 300
while 0 <= idxA and cntC[idxA] == 0: idxA -= 1
idxB = 300
while 0 <= idxB and cntD[idxB] == 0: idxB -= 1
ans = 0
for s in A[::-1]:
while 0 <= idx and idxA <= idxB:
D[B[idx]] += 1
cntD[idxB] -= 1
while 0 <= idxB and cntD[idxB] == 0: idxB -= 1
idx -= 1
ans += D[X-s]
cntC[idxA] -= 1
while 0 <= idxA and cntC[idxA] == 0: idxA -= 1
print(ans)
detteiuu