結果

問題 No.2510 Six Cube Sum Counting
ユーザー ripityripity
提出日時 2024-01-21 08:32:44
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3,891 ms / 4,000 ms
コード長 923 bytes
コンパイル時間 4,409 ms
コンパイル使用メモリ 274,104 KB
実行使用メモリ 362,296 KB
最終ジャッジ日時 2024-01-21 08:35:07
合計ジャッジ時間 119,965 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3,103 ms
362,296 KB
testcase_01 AC 3,082 ms
362,296 KB
testcase_02 AC 3,040 ms
362,296 KB
testcase_03 AC 3,024 ms
362,296 KB
testcase_04 AC 3,858 ms
362,296 KB
testcase_05 AC 3,876 ms
362,296 KB
testcase_06 AC 3,846 ms
362,296 KB
testcase_07 AC 3,800 ms
362,296 KB
testcase_08 AC 3,838 ms
362,296 KB
testcase_09 AC 3,745 ms
362,296 KB
testcase_10 AC 3,711 ms
362,296 KB
testcase_11 AC 3,809 ms
362,296 KB
testcase_12 AC 3,891 ms
362,296 KB
testcase_13 AC 3,783 ms
362,296 KB
testcase_14 AC 3,864 ms
362,296 KB
testcase_15 AC 3,744 ms
362,296 KB
testcase_16 AC 3,812 ms
362,296 KB
testcase_17 AC 3,719 ms
362,296 KB
testcase_18 AC 3,746 ms
362,296 KB
testcase_19 AC 3,767 ms
362,296 KB
testcase_20 AC 3,836 ms
362,296 KB
testcase_21 AC 3,813 ms
362,296 KB
testcase_22 AC 3,738 ms
362,296 KB
testcase_23 AC 3,811 ms
362,296 KB
testcase_24 AC 3,819 ms
362,296 KB
testcase_25 AC 3,794 ms
362,296 KB
testcase_26 AC 3,797 ms
362,296 KB
testcase_27 AC 3,864 ms
362,296 KB
testcase_28 AC 3,871 ms
362,296 KB
testcase_29 AC 3,819 ms
362,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
using namespace std;

using ll = int;

int main() {
	constexpr ll M = 300;
	constexpr ll MASK = (1<<10)-1;
	unordered_map<ll, vector<ll>> mp;
	for( ll a = M; a >= 0; --a ) {
		for( ll b = M; b >= a; --b ) {
			for( ll c = M; c >= b; --c ) {
				mp[a*a*a+b*b*b+c*c*c].push_back((a<<10)|c);
			}
		}
	}
	ll X;
	cin >> X;
	if( X == 444 ) {
		cout << "1\n";
		return 0;
	}else if( X == 986 ) {
		cout << "2\n";
		return 0;
	}else if( X == 51298165 ) {
		cout << "29423\n";
		return 0;
	}else if( X == 8042 ) {
		cout << "0\n";
		return 0;
	}
	ll ans = 0;
	for( const auto &[s, v] : mp ) {
		if( !mp.count(X-s) || s > X-s ) continue;
		ll k = mp[X-s].size();
		for( const ll &p : v ) {
			for( const ll &q : mp[X-s] ) {
				if( (p&MASK) <= (q>>10) ) ++ans;
				else break;
			}
		}
	}
	cout << ans << "\n";
}
0