結果

問題 No.2510 Six Cube Sum Counting
コンテスト
ユーザー なえしら
提出日時 2023-10-20 22:48:57
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
TLE  
実行時間 -
コード長 506 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 186 ms
コンパイル使用メモリ 84,816 KB
実行使用メモリ 1,153,820 KB
最終ジャッジ日時 2026-04-09 05:46:24
合計ジャッジ時間 16,754 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 TLE * 1
other AC * 3 WA * 2 TLE * 16 MLE * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from collections import defaultdict
from itertools import combinations_with_replacement

X = int(input())
C = defaultdict(list)
D = defaultdict(list)
for a, b, c in combinations_with_replacement(range(301), 3):
  x = a**3 + b**3 + c**3
  if 2 * x <= X:
    C[x].append(c)
  elif x <= X:
    D[x].append(a)
cnt = 0
for x in C:
  if 2 * x > X: break
  y = X - x
  C[x].sort()
  j = 0
  for i in range(len(C[x])):
    while j < len(D[y]) and D[y][j] < C[x][i]:
      j += 1
    cnt += len(D[y]) - j
print(cnt)
0