結果
問題 | No.2510 Six Cube Sum Counting |
ユーザー |
![]() |
提出日時 | 2023-10-20 22:44:21 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,100 bytes |
コンパイル時間 | 3,982 ms |
コンパイル使用メモリ | 239,596 KB |
実行使用メモリ | 651,676 KB |
最終ジャッジ日時 | 2024-09-20 20:39:27 |
合計ジャッジ時間 | 9,522 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 MLE * 1 -- * 1 |
other | -- * 26 |
ソースコード
#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 longusing 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))#endifint 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;}