結果

問題 No.2510 Six Cube Sum Counting
ユーザー naesiranaesira
提出日時 2023-10-20 22:48:57
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 506 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 81,864 KB
実行使用メモリ 923,664 KB
最終ジャッジ日時 2023-10-20 22:49:05
合計ジャッジ時間 7,426 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 AC 240 ms
75,396 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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