結果
| 問題 |
No.2510 Six Cube Sum Counting
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-10-20 22:34:22 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 1,098 bytes |
| コンパイル時間 | 1,000 ms |
| コンパイル使用メモリ | 81,800 KB |
| 最終ジャッジ日時 | 2025-02-17 10:17:39 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | MLE * 1 -- * 3 |
| other | -- * 26 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<atcoder/modint>
using namespace std;
using namespace atcoder;
using ll=long long;
using mint=modint998244353;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;}
template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;}
vector<int>V[81000001];
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll X;
cin>>X;
ll S=0;
ll ans=0;
for(int x=0;x<=300;x++)for(int y=x;y<=300;y++)for(int z=y;z<=300;z++){
V[x*x*x+y*y*y+z*z*z].push_back(x);
}
for(int a=0;S<=X&&a<=300;a++){
S+=a*a*a;
for(int b=a;S+b*b*b<=X&&b<=300;b++){
S+=b*b*b;
for(int c=b;S+c*c*c<=X&&c<=300;c++){
S+=c*c*c;
if(X-S<=81000000)ans+=V[X-S].end()-lower_bound(all(V[X-S]),c);
S-=c*c*c;
}
S-=b*b*b;
}
S-=a*a*a;
}
cout<<ans<<"\n";
}