結果

問題 No.2510 Six Cube Sum Counting
ユーザー AerenAeren
提出日時 2023-10-20 22:27:58
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2,829 ms / 4,000 ms
コード長 1,639 bytes
コンパイル時間 3,496 ms
コンパイル使用メモリ 270,692 KB
実行使用メモリ 45,584 KB
最終ジャッジ日時 2023-10-20 22:29:08
合計ジャッジ時間 67,983 ms
ジャッジサーバーID
(参考情報)
judge10 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 565 ms
45,584 KB
testcase_01 AC 582 ms
45,584 KB
testcase_02 AC 2,513 ms
45,584 KB
testcase_03 AC 599 ms
45,584 KB
testcase_04 AC 544 ms
45,584 KB
testcase_05 AC 550 ms
45,584 KB
testcase_06 AC 2,766 ms
45,584 KB
testcase_07 AC 2,788 ms
45,584 KB
testcase_08 AC 2,829 ms
45,584 KB
testcase_09 AC 2,799 ms
45,584 KB
testcase_10 AC 2,815 ms
45,584 KB
testcase_11 AC 2,786 ms
45,584 KB
testcase_12 AC 2,806 ms
45,584 KB
testcase_13 AC 2,807 ms
45,584 KB
testcase_14 AC 2,829 ms
45,584 KB
testcase_15 AC 589 ms
45,584 KB
testcase_16 AC 596 ms
45,584 KB
testcase_17 AC 548 ms
45,584 KB
testcase_18 AC 2,786 ms
45,584 KB
testcase_19 AC 2,817 ms
45,584 KB
testcase_20 AC 1,988 ms
45,584 KB
testcase_21 AC 2,532 ms
45,584 KB
testcase_22 AC 2,292 ms
45,584 KB
testcase_23 AC 2,101 ms
45,584 KB
testcase_24 AC 2,486 ms
45,584 KB
testcase_25 AC 2,823 ms
45,584 KB
testcase_26 AC 2,734 ms
45,584 KB
testcase_27 AC 2,585 ms
45,584 KB
testcase_28 AC 2,821 ms
45,584 KB
testcase_29 AC 2,421 ms
45,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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



int main(){
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(ios::badbit | ios::failbit);
	vector<vector<int>> left(301), right(301);
	for(auto x = 0; x <= 300; ++ x){
		for(auto y = x; y <= 300; ++ y){
			for(auto z = y; z <= 300; ++ z){
				left[z].push_back(x * x * x + y * y * y + z * z * z);
				right[x].push_back(x * x * x + y * y * y + z * z * z);
			}
		}
	}
	for(auto x = 0; x <= 300; ++ x){
		ranges::sort(left[x]);
		ranges::sort(right[x] | ranges::views::reverse);
	}
	int obj;
	cin >> obj;
	int res = 0;
	for(auto c = 0; c <= 300; ++ c){
		for(auto d = c; d <= 300; ++ d){
			for(auto cl = 0, dl = 0; cl < (int)left[c].size() && left[c][cl] <= obj / 2; ){
				int cr = cl;
				while(cr < (int)left[c].size() && left[c][cl] == left[c][cr]){
					++ cr;
				}
				int rem = obj - left[c][cl];
				while(dl < (int)right[d].size() && right[d][dl] > rem){
					++ dl;
				}
				int dr = dl;
				while(dr < (int)right[d].size() && right[d][dr] == rem){
					++ dr;
				}
				res += (cr - cl) * (dr - dl);
				cl = cr;
				dl = dr;
			}
		}
	}
	cout << res << "\n";
	return 0;
}

/*

*/

////////////////////////////////////////////////////////////////////////////////////////
//                                                                                    //
//                                   Coded by Aeren                                   //
//                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////
0