結果

問題 No.2510 Six Cube Sum Counting
ユーザー 👑 amentorimaruamentorimaru
提出日時 2023-09-22 19:51:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 3,066 ms / 4,000 ms
コード長 595 bytes
コンパイル時間 341 ms
コンパイル使用メモリ 81,872 KB
実行使用メモリ 392,064 KB
最終ジャッジ日時 2023-10-19 16:33:43
合計ジャッジ時間 75,166 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,400 ms
391,492 KB
testcase_01 AC 2,340 ms
391,492 KB
testcase_02 AC 2,541 ms
391,752 KB
testcase_03 AC 2,359 ms
391,228 KB
testcase_04 AC 36 ms
53,560 KB
testcase_05 AC 2,311 ms
391,228 KB
testcase_06 AC 2,378 ms
391,228 KB
testcase_07 AC 2,265 ms
391,228 KB
testcase_08 AC 2,302 ms
391,492 KB
testcase_09 AC 2,314 ms
391,224 KB
testcase_10 AC 2,390 ms
391,228 KB
testcase_11 AC 2,388 ms
391,228 KB
testcase_12 AC 2,338 ms
391,228 KB
testcase_13 AC 2,335 ms
391,228 KB
testcase_14 AC 2,315 ms
391,228 KB
testcase_15 AC 2,350 ms
391,228 KB
testcase_16 AC 2,336 ms
391,228 KB
testcase_17 AC 2,251 ms
391,228 KB
testcase_18 AC 2,308 ms
391,228 KB
testcase_19 AC 2,280 ms
391,228 KB
testcase_20 AC 2,371 ms
391,488 KB
testcase_21 AC 2,444 ms
391,752 KB
testcase_22 AC 2,554 ms
392,016 KB
testcase_23 AC 2,487 ms
391,488 KB
testcase_24 AC 2,504 ms
391,752 KB
testcase_25 AC 2,317 ms
391,228 KB
testcase_26 AC 2,912 ms
391,540 KB
testcase_27 AC 3,066 ms
392,064 KB
testcase_28 AC 2,327 ms
391,228 KB
testcase_29 AC 2,469 ms
392,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
n = int(input())
if n==0:
    print(1)
    exit()
ans = 0
cubes = {}
for a in range(301):
	a3 = a * a * a
	for b in range(a, 301):
		b3 = b * b * b
		for c in range(b, 301):
			c3 = c * c * c
			x = a3 + b3 + c3
			y = (a << 18) | (b << 9) | c
			cubes[x] = (cubes.get(x,0) << 27) | y
for x, tw in cubes.items():
	z = n - x
	w1 = tw
	if not z in cubes:
		continue
	while w1:
		z = n - x
		w2 = cubes[z]
		while w2:
			if w2 & 0x1ff <= (w1 >> 18) & 0x1ff:
				ans += 1
			w2 >>= 27
		w1 >>= 27
					
w = cubes.get(n,0)
while w:
	ans += 1
	w >>= 27
print(ans)
0