結果
| 問題 |
No.2510 Six Cube Sum Counting
|
| コンテスト | |
| ユーザー |
momoyuu
|
| 提出日時 | 2023-10-28 13:33:12 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1,254 ms / 4,000 ms |
| コード長 | 845 bytes |
| コンパイル時間 | 3,130 ms |
| コンパイル使用メモリ | 254,096 KB |
| 実行使用メモリ | 297,920 KB |
| 最終ジャッジ日時 | 2024-09-25 16:24:19 |
| 合計ジャッジ時間 | 37,029 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int mx = 3e7;
ll cnt[mx];
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
ll ans = 0;
int x;
cin>>x;
map<int,ll> memo;
for(int i = 0;i<=300;i++){
for(int b = 0;b<=i;b++){
for(int a = 0;a<=b;a++){
int now = a * a * a + b * b * b + i * i * i;
if(now<mx) cnt[now]++;
else memo[now]++;
}
}
for(int e = i;e<=300;e++){
for(int f = e;f<=300;f++){
int now = e * e * e + f * f * f + i * i * i;
if(x-now<0) continue;
if(x-now<mx) ans += cnt[x-now];
else if(memo.find(x-now)!=memo.end()) ans += memo[x-now];
}
}
}
cout<<ans<<endl;
}
momoyuu