結果

問題 No.2510 Six Cube Sum Counting
ユーザー maksimmaksim
提出日時 2023-10-20 21:45:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 1,164 bytes
コンパイル時間 2,104 ms
コンパイル使用メモリ 180,376 KB
実行使用メモリ 548,140 KB
最終ジャッジ日時 2023-10-20 21:47:11
合計ジャッジ時間 61,661 ms
ジャッジサーバーID
(参考情報)
judge12 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
bitset<81000001> ok;
int id[81000001];
vector<short> u[3996739];
int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    for(int i=0;i<=300;++i)
    {
        for(int e=i;e<=300;++e)
        {
            for(int f=e;f<=300;++f)
            {
                ok[i*i*i+e*e*e+f*f*f]=1;
            }
        }
    }
    int cur=0;
    for(int i=0;i<=81000000;++i)
    {
        if(ok[i]) id[i]=cur++;
        else id[i]=cur;
    }
     for(int i=0;i<=300;++i)
    {
        for(int e=i;e<=300;++e)
        {
            for(int f=e;f<=300;++f)
            {
                u[id[i*i*i+e*e*e+f*f*f]].push_back(i);
            }
        }
    }
    int x;cin>>x;
    int res=0;
    for(int a=0;a<=300;++a)
    {
        for(int b=a;b<=300;++b)
        {
            for(int c=b;c<=300;++c)
            {
                int rem=x-a*a*a-b*b*b-c*c*c;
                if(rem<0 || rem>=81000001 || !ok[rem]) continue;
                res+=u[id[rem]].end()-lower_bound(u[id[rem]].begin(),u[id[rem]].end(),c);
            }
        }
    }
    cout<<res;
    return 0;
}
0