結果

問題 No.2510 Six Cube Sum Counting
ユーザー AerenAeren
提出日時 2023-10-20 22:21:35
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,536 bytes
コンパイル時間 3,775 ms
コンパイル使用メモリ 259,672 KB
実行使用メモリ 45,568 KB
最終ジャッジ日時 2023-10-20 22:22:44
合計ジャッジ時間 65,509 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,973 ms
45,568 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 1,951 ms
45,568 KB
testcase_05 AC 1,958 ms
45,568 KB
testcase_06 WA -
testcase_07 AC 1,925 ms
45,568 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 1,977 ms
45,568 KB
testcase_13 AC 1,948 ms
45,568 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

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);
				right[x].push_back(y * y * y + z * z * z);
			}
		}
	}
	for(auto x = 0; x <= 300; ++ x){
		ranges::sort(left[x]);
		ranges::sort(right[x]);
	}
	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, dr = (int)right[d].size(); cl < (int)left[c].size(); ){
				int cr = cl;
				while(cr < (int)left[c].size() && left[c][cl] == left[c][cr]){
					++ cr;
				}
				while(dr > 0 && right[d][dr - 1] > left[c][cl]){
					-- dr;
				}
				int dl = dr;
				while(dl > 0 && right[d][dl - 1] == left[c][cl]){
					-- dl;
				}
				res += (cr - cl) * (dr - dl);
				cl = cr;
				dr = dl;
			}
		}
	}
	cout << res << "\n";
	return 0;
}

/*

*/

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