結果
問題 | No.2510 Six Cube Sum Counting |
ユーザー |
|
提出日時 | 2023-10-21 05:19:48 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 685 bytes |
コンパイル時間 | 1,896 ms |
コンパイル使用メモリ | 179,260 KB |
実行使用メモリ | 435,456 KB |
最終ジャッジ日時 | 2024-09-21 06:27:54 |
合計ジャッジ時間 | 7,151 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 TLE * 1 -- * 1 |
other | -- * 26 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> P; #define REP(i,n) for(int i=0;i<int(n);i++) int main(void){ cin.tie(nullptr); ios_base::sync_with_stdio(false); int i,j,k; int X; cin >> X; map<int,vector<P> > m; for(int c=0;c<=300;c++){ for(int b=0;b<=c;b++){ for(int a=0;a<=b;a++){ int s=a*a*a+b*b*b+c*c*c; if(s>X) continue; m[s].push_back(P(a,c)); } } } int ans=0; for(auto x : m){ int t=x.first; if(2*t>X) break;; int N=m[t].size(); REP(i,N){ int p=m[t][i].second; int n=m[X-t].size(); REP(j,n) if(m[X-t][j].first>=p) ans++; } } cout << ans << endl; return 0; }