結果

問題 No.2510 Six Cube Sum Counting
ユーザー amentorimaru
提出日時 2023-09-22 20:01:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,405 ms / 4,000 ms
コード長 573 bytes
コンパイル時間 325 ms
コンパイル使用メモリ 82,168 KB
実行使用メモリ 392,628 KB
最終ジャッジ日時 2024-09-19 12:53:44
合計ジャッジ時間 68,685 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

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