結果

問題 No.2510 Six Cube Sum Counting
ユーザー maeshunmaeshun
提出日時 2023-10-20 22:44:21
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 1,100 bytes
コンパイル時間 3,911 ms
コンパイル使用メモリ 238,996 KB
実行使用メモリ 669,644 KB
最終ジャッジ日時 2023-10-20 22:44:35
合計ジャッジ時間 9,747 ms
ジャッジサーバーID
(参考情報)
judge9 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 AC 11 ms
5,056 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
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;
#include <atcoder/all>
using namespace atcoder;
#define rep(i, n) for(int i=0;i<(n);++i)
#define rep1(i, n) for(int i=1;i<=(n);i++)
#define ll long long
using mint = modint998244353;
using P = pair<ll,ll>;
using lb = long double;
using T = tuple<ll, ll, ll>;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
#ifdef LOCAL
#  include <debug_print.hpp>
#  define dbg(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#  define dbg(...) (static_cast<void>(0))
#endif

int main()
{ 
    ll x;
    cin >> x;
    ll ans = 0;
    vector<map<int,int>> f(301);
    vector<vector<int>> s(301);
    for(int i=0;i<=300;i++){
      for(int j=i;j<=300;j++){
        for(int k=j;k<=300;k++){
          int val = i*i*i+j*j*j+k*k*k;
          if(val>=x/2 && val<=x) f[i][val]++; 
          if(val<=x/2) s[k].push_back(val);
        }
      }
    }
    for(int k=0;k<=300;k++){
      for(int i=k;i<=300;i++){
        for(int p : s[k]){
          ans += f[i][x-p];
        }
      }
    }
    cout << ans << endl;
    return 0;
}
0