結果

問題 No.2510 Six Cube Sum Counting
コンテスト
ユーザー 👑 amentorimaru
提出日時 2023-09-22 19:28:49
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 1,984 ms / 4,000 ms
コード長 678 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 438 ms
コンパイル使用メモリ 85,128 KB
実行使用メモリ 390,792 KB
最終ジャッジ日時 2026-04-07 23:47:33
合計ジャッジ時間 57,057 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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
			if x not in cubes:
				cubes[x] = 0
			cubes[x] <<= 27
			cubes[x] |= y
for d in range(301):
	d3 = d * d * d
	for e in range(d, 301):
		e3 = e * e * e
		for f in range(e, 301):
			f3 = f * f * f
			x = d3 + e3 + f3
			z = n - x
			if z in cubes:
				w = cubes[z]
				while w:
					if w & 0x1ff <= d:
						ans += 1
					w >>= 27
					
w = cubes.get(n,0)
while w:
	ans += 1
	w >>= 27
print(ans)
0