結果

問題 No.2510 Six Cube Sum Counting
ユーザー momoyuumomoyuu
提出日時 2023-10-28 13:33:12
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,117 ms / 4,000 ms
コード長 845 bytes
コンパイル時間 3,034 ms
コンパイル使用メモリ 253,416 KB
実行使用メモリ 297,988 KB
最終ジャッジ日時 2023-10-28 13:33:51
合計ジャッジ時間 32,293 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 910 ms
297,988 KB
testcase_01 AC 867 ms
297,988 KB
testcase_02 AC 1,117 ms
297,988 KB
testcase_03 AC 959 ms
297,988 KB
testcase_04 AC 917 ms
297,988 KB
testcase_05 AC 942 ms
297,988 KB
testcase_06 AC 863 ms
297,988 KB
testcase_07 AC 838 ms
297,988 KB
testcase_08 AC 898 ms
297,988 KB
testcase_09 AC 928 ms
297,988 KB
testcase_10 AC 824 ms
297,988 KB
testcase_11 AC 857 ms
297,988 KB
testcase_12 AC 854 ms
297,988 KB
testcase_13 AC 878 ms
297,988 KB
testcase_14 AC 855 ms
297,988 KB
testcase_15 AC 885 ms
297,988 KB
testcase_16 AC 815 ms
297,988 KB
testcase_17 AC 784 ms
297,988 KB
testcase_18 AC 769 ms
297,988 KB
testcase_19 AC 797 ms
297,988 KB
testcase_20 AC 1,061 ms
297,988 KB
testcase_21 AC 996 ms
297,988 KB
testcase_22 AC 1,011 ms
297,988 KB
testcase_23 AC 983 ms
297,988 KB
testcase_24 AC 1,016 ms
297,988 KB
testcase_25 AC 851 ms
297,988 KB
testcase_26 AC 876 ms
297,988 KB
testcase_27 AC 990 ms
297,988 KB
testcase_28 AC 932 ms
297,988 KB
testcase_29 AC 1,087 ms
297,988 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0