結果

問題 No.2510 Six Cube Sum Counting
ユーザー 👑 binapbinap
提出日時 2023-10-21 00:37:29
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,569 bytes
コンパイル時間 5,320 ms
コンパイル使用メモリ 267,452 KB
実行使用メモリ 362,372 KB
最終ジャッジ日時 2023-10-21 00:39:18
合計ジャッジ時間 98,605 ms
ジャッジサーバーID
(参考情報)
judge10 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 TLE -
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 TLE -
testcase_19 TLE -
testcase_20 AC 2,638 ms
221,376 KB
testcase_21 TLE -
testcase_22 AC 3,891 ms
321,492 KB
testcase_23 AC 3,116 ms
253,056 KB
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 TLE -
testcase_28 TLE -
testcase_29 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long>> vvl;
typedef long double ld;

template <int m>
std::ostream& operator<<(std::ostream& os, const atcoder::static_modint<m>& a) {os << a.val(); return os;}
template<typename T>
istream& operator>>(istream& is, vector<T>& v){int n = v.size(); assert(n > 0); rep(i, n) is >> v[i]; return is;}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v){int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "\n" : " "); return os;}
template <typename T>
ostream& operator<<(ostream& os, const vector<vector<T>>& v){int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "\n" : ""); return os;}

int main(){
	int n;
	cin >> n;
	auto cu = [&](int i){
		return i * i * i;
	};
	unordered_map<int, vector<int>> ma;
	for(int a = 0; a <= 300; a++){
		for(int b = a; b <= 300; b++){
			for(int c = b; c <= 300; c++){
				int x = cu(a) + cu(b) + cu(c);
				if(x > n) break;
				ma[x].push_back(c);
			}
		}
	}
	ll ans = 0;
	for(int d = 0; d <= 300; d++){
		if(3 * cu(d) > n) break;
		for(int e = d; e <= 300; e++){
			if(cu(d) + 2 * cu(e) > n) break;
			for(int f = e; f <= 300; f++){
				int x = cu(d) + cu(e) + cu(f);
				if(x > n) break;
				int y = n - x;
				if(ma.find(y) != ma.end()){
					for(int c : ma[y]){
						if(c <= d) ans++;
					}
				}
			}
		}
	}
	cout << ans;
	return 0;
}
0