結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3,312 ms
362,296 KB
testcase_01 AC 3,284 ms
362,296 KB
testcase_02 AC 3,313 ms
362,296 KB
testcase_03 AC 3,303 ms
362,296 KB
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
testcase_10 TLE -
testcase_11 AC 3,983 ms
362,296 KB
testcase_12 TLE -
testcase_13 AC 3,978 ms
362,296 KB
testcase_14 AC 3,959 ms
362,296 KB
testcase_15 AC 3,957 ms
362,296 KB
testcase_16 AC 3,969 ms
362,296 KB
testcase_17 AC 3,962 ms
362,296 KB
testcase_18 AC 3,977 ms
362,296 KB
testcase_19 AC 3,955 ms
362,296 KB
testcase_20 AC 3,965 ms
362,296 KB
testcase_21 AC 3,952 ms
362,296 KB
testcase_22 AC 3,990 ms
362,296 KB
testcase_23 AC 3,998 ms
362,296 KB
testcase_24 AC 3,941 ms
362,296 KB
testcase_25 AC 3,960 ms
362,296 KB
testcase_26 AC 3,989 ms
362,296 KB
testcase_27 TLE -
testcase_28 AC 3,993 ms
362,296 KB
testcase_29 AC 3,980 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