結果

問題 No.2510 Six Cube Sum Counting
ユーザー 👑 hos.lyric
提出日時 2023-10-20 22:23:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 344 ms / 4,000 ms
コード長 1,921 bytes
コンパイル時間 986 ms
コンパイル使用メモリ 106,232 KB
実行使用メモリ 280,352 KB
最終ジャッジ日時 2024-09-20 19:53:50
合計ジャッジ時間 10,565 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

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 cu(int a) {
return a * a * a;
}
constexpr int L = 300;
constexpr int M = 3 * cu(L);
int freq[M + 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;
if (tar <= M) {
ans += freq[tar];
}
}
}
}
printf("%lld\n", ans);
}
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0