結果
問題 |
No.2510 Six Cube Sum Counting
|
ユーザー |
|
提出日時 | 2023-10-20 22:21:35 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,536 bytes |
コンパイル時間 | 3,256 ms |
コンパイル使用メモリ | 259,268 KB |
実行使用メモリ | 45,696 KB |
最終ジャッジ日時 | 2024-09-20 19:49:26 |
合計ジャッジ時間 | 56,689 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 3 |
other | AC * 5 WA * 21 |
ソースコード
#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 // // // ////////////////////////////////////////////////////////////////////////////////////////