結果

問題 No.2510 Six Cube Sum Counting
ユーザー 👑 amentorimaruamentorimaru
提出日時 2023-09-22 20:01:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,762 ms / 4,000 ms
コード長 573 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 81,820 KB
実行使用メモリ 392,012 KB
最終ジャッジ日時 2023-10-19 16:34:22
合計ジャッジ時間 76,112 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,385 ms
391,484 KB
testcase_01 AC 2,440 ms
391,220 KB
testcase_02 AC 2,615 ms
391,748 KB
testcase_03 AC 2,412 ms
391,220 KB
testcase_04 AC 35 ms
53,556 KB
testcase_05 AC 2,410 ms
391,220 KB
testcase_06 AC 2,557 ms
391,484 KB
testcase_07 AC 2,411 ms
391,220 KB
testcase_08 AC 2,476 ms
391,484 KB
testcase_09 AC 2,449 ms
391,220 KB
testcase_10 AC 2,361 ms
391,220 KB
testcase_11 AC 2,424 ms
391,220 KB
testcase_12 AC 2,407 ms
391,220 KB
testcase_13 AC 2,459 ms
391,220 KB
testcase_14 AC 2,458 ms
391,220 KB
testcase_15 AC 2,492 ms
391,220 KB
testcase_16 AC 2,393 ms
391,220 KB
testcase_17 AC 2,409 ms
391,220 KB
testcase_18 AC 2,479 ms
391,220 KB
testcase_19 AC 2,514 ms
391,220 KB
testcase_20 AC 2,580 ms
391,484 KB
testcase_21 AC 2,591 ms
391,484 KB
testcase_22 AC 2,587 ms
392,012 KB
testcase_23 AC 2,624 ms
391,484 KB
testcase_24 AC 2,762 ms
391,748 KB
testcase_25 AC 2,441 ms
391,220 KB
testcase_26 AC 2,503 ms
391,484 KB
testcase_27 AC 2,627 ms
391,484 KB
testcase_28 AC 2,479 ms
391,220 KB
testcase_29 AC 2,688 ms
392,012 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():
	if n - x in cubes:
		w1 = tw
		while w1:
			w2 = cubes[n - x]
			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