結果

問題 No.2510 Six Cube Sum Counting
ユーザー sgfcsgfc
提出日時 2023-10-20 23:59:23
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2,998 ms / 4,000 ms
コード長 679 bytes
コンパイル時間 2,739 ms
コンパイル使用メモリ 249,792 KB
実行使用メモリ 174,804 KB
最終ジャッジ日時 2023-10-21 00:01:03
合計ジャッジ時間 89,405 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,723 ms
174,804 KB
testcase_01 AC 2,713 ms
174,804 KB
testcase_02 AC 2,688 ms
174,804 KB
testcase_03 AC 2,741 ms
174,804 KB
testcase_04 AC 2,728 ms
174,804 KB
testcase_05 AC 2,688 ms
174,804 KB
testcase_06 AC 2,705 ms
174,804 KB
testcase_07 AC 2,746 ms
174,804 KB
testcase_08 AC 2,815 ms
174,804 KB
testcase_09 AC 2,724 ms
174,804 KB
testcase_10 AC 2,740 ms
174,804 KB
testcase_11 AC 2,694 ms
174,804 KB
testcase_12 AC 2,952 ms
174,804 KB
testcase_13 AC 2,998 ms
174,804 KB
testcase_14 AC 2,848 ms
174,804 KB
testcase_15 AC 2,744 ms
174,804 KB
testcase_16 AC 2,758 ms
174,804 KB
testcase_17 AC 2,873 ms
174,804 KB
testcase_18 AC 2,772 ms
174,804 KB
testcase_19 AC 2,708 ms
174,804 KB
testcase_20 AC 2,857 ms
174,804 KB
testcase_21 AC 2,747 ms
174,804 KB
testcase_22 AC 2,749 ms
174,804 KB
testcase_23 AC 2,771 ms
174,804 KB
testcase_24 AC 2,777 ms
174,804 KB
testcase_25 AC 2,744 ms
174,804 KB
testcase_26 AC 2,764 ms
174,804 KB
testcase_27 AC 2,800 ms
174,804 KB
testcase_28 AC 2,667 ms
174,804 KB
testcase_29 AC 2,729 ms
174,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#include <unordered_map>
#include <unordered_set>


using namespace std;
int main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int x;
	cin >> x;


	unordered_map<int, int> mp;

	int ans = 0;
	for (int d = 0; d < 301; ++d) {
		int c3 = d*d*d;
		for (int b = 0; b < d + 1; ++b) {
			int b3 = b * b * b;
			for (int a = 0; a < b + 1; ++a) {
				int tx = a * a * a + b3 + c3;
				mp[tx]++;
			}
		}

		int d3 = c3;
		for (int e = d; e < 301; ++e) {
			int e3 = e * e * e;
			for (int f = e; f < 301; ++f) {
				const int t = x - (d3 + e3 + f * f * f);
				if (mp.find(t) == mp.end()) continue;
				ans += mp[t];
			}
		}
	}

	cout << ans << endl;
}
0