結果

問題 No.2510 Six Cube Sum Counting
ユーザー hiro71687khiro71687k
提出日時 2023-10-20 23:11:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 2,447 bytes
コンパイル時間 2,228 ms
コンパイル使用メモリ 204,192 KB
実行使用メモリ 640,580 KB
最終ジャッジ日時 2023-10-20 23:12:10
合計ジャッジ時間 15,755 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 MLE -
testcase_02 MLE -
testcase_03 MLE -
testcase_04 MLE -
testcase_05 MLE -
testcase_06 MLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll=int;
using ld=long double;
ld pie=3.141592653589793;
ll mod=998244353;
ll inf=100000;//10^17
int main(){
    ll x;
    cin >> x;
    ll ans=0;
    vector<ll>memo(400,0);
    for (ll i = 0; i < 400; i++)
    {
        memo[i]=i*i*i;
    }
    vector<ll>g(27000001,inf);
    for (ll i = 0; i <=300; i++)
    {
        g[i*i*i]=i;
    }
    ll dai=300*300*300;
    vector<ll>gg(54000001,0);
    for (ll i = 0; i <=300; i++)
    {
        for (ll j = 0; j <=300; j++)
        {
            gg[i*i*i+j*j*j]=1;
        }
    }
    vector<ll>ggg(81000001,0);
    for (ll i = 0; i <=300; i++)
    {
        for (ll j = 0; j <=300; j++)
        {
            for (ll k = 0; k <=300; k++)
            {
                ggg[i*i*i+j*j*j+k*k*k]=1;
            }
        }
    }
    for (ll f = 0; f <=300; f++)
    {
        ll ff=memo[f];
        if (ff>x)
        {
            break;
        }
        for (ll e = 0; e <=f; e++)
        {
            ll ee=memo[e]+ff;
            if (ee>x)
            {
                break;
            }
            for (ll d = 0; d <=e; d++)
            {
                ll dd=memo[d]+ee;
                if (dd>x)
                {
                    break;
                }
                if (x-dd<=dai*3)
                {
                    if (ggg[x-dd]==0)
                    {
                        continue;
                    }
                }
                for (ll c = 0; c <=d; c++)
                {
                    ll cc=memo[c]+dd;
                    if (cc>x)
                    {
                        break;
                    }
                    if (x-cc<=dai*2)
                    {
                        if (gg[x-cc]==0)
                        {
                            continue;
                        }
                    }
                    for (ll b = 0; b <=c; b++)
                    {
                        ll bb=memo[b]+cc;
                        if (bb>x)
                        {
                            break;
                        }
                        if (x-bb>dai)
                        {
                            continue;
                        }
                        if (g[x-bb]<=b)
                        {
                            ans++;
                        }
                    }
                }
            }
        }
    }
    cout << ans << endl;
}
0