結果

問題 No.2510 Six Cube Sum Counting
ユーザー 👑 hos.lyrichos.lyric
提出日時 2023-10-20 22:22:20
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,861 bytes
コンパイル時間 2,104 ms
コンパイル使用メモリ 108,132 KB
実行使用メモリ 319,868 KB
最終ジャッジ日時 2023-10-20 22:23:06
合計ジャッジ時間 18,996 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
280,396 KB
testcase_01 AC 123 ms
280,396 KB
testcase_02 AC 312 ms
315,780 KB
testcase_03 AC 120 ms
280,396 KB
testcase_04 AC 119 ms
280,396 KB
testcase_05 AC 146 ms
280,396 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 130 ms
280,396 KB
testcase_16 AC 128 ms
280,396 KB
testcase_17 AC 129 ms
280,396 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 AC 218 ms
319,868 KB
testcase_21 AC 342 ms
319,868 KB
testcase_22 AC 263 ms
319,868 KB
testcase_23 AC 238 ms
319,868 KB
testcase_24 AC 301 ms
319,868 KB
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 338 ms
319,864 KB
testcase_28 RE -
testcase_29 AC 289 ms
319,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

using Int = long long;

template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")


constexpr int L = 300;

constexpr int cu(int a) {
  return a * a * a;
}

int freq[3 * cu(L) + 1];

int main() {
  int X;
  for (; ~scanf("%d", &X); ) {
#ifdef LOCAL
    memset(freq, 0, sizeof(freq));
#endif
    Int ans = 0;
    for (int d = 0; d <= L; ++d) {
      for (int b = 0; b <= d; ++b) for (int a = 0; a <= b; ++a) {
        ++freq[cu(a) + cu(b) + cu(d)];
      }
      for (int e = d; e <= L; ++e) {
        for (int f = e; f <= L; ++f) {
          const int tar = X - (cu(d) + cu(e) + cu(f));
          if (tar < 0) break;
          ans += freq[tar];
        }
      }
    }
    printf("%lld\n", ans);
  }
  return 0;
}
0