結果
| 問題 |
No.2510 Six Cube Sum Counting
|
| コンテスト | |
| ユーザー |
maeshun
|
| 提出日時 | 2023-10-20 23:20:30 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1,379 ms / 4,000 ms |
| コード長 | 1,487 bytes |
| コンパイル時間 | 4,219 ms |
| コンパイル使用メモリ | 246,504 KB |
| 実行使用メモリ | 136,332 KB |
| 最終ジャッジ日時 | 2024-09-20 23:02:00 |
| 合計ジャッジ時間 | 31,621 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:40:12: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
40 | auto [val, t]= s[i];
| ^
main.cpp:43:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
43 | auto [a,b,c] = t;
| ^
main.cpp:44:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
44 | auto [val2, t2] = s[it];
| ^
main.cpp:45:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
45 | auto [d,e,f] = t2;
| ^
ソースコード
#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<int, int, int>;
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<pair<int,tuple<int,int,int>>> s;
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;
s.emplace_back(val,T(i,j,k));
}
}
}
int m = s.size();
sort(s.begin(),s.end());
vector<int> S;
rep(i,m) S.push_back(s[i].first);
set<vector<int>> D;
rep(i,m){
auto [val, t]= s[i];
int it = lower_bound(S.begin(),S.end(),x-val) - S.begin();
if(S[it]==x-val) {
auto [a,b,c] = t;
auto [val2, t2] = s[it];
auto [d,e,f] = t2;
vector<int> vs;
vs.push_back(a);
vs.push_back(b);
vs.push_back(c);
vs.push_back(d);
vs.push_back(e);
vs.push_back(f);
sort(vs.begin(),vs.end());
D.insert(vs);
}
}
cout<<D.size()<<endl;
return 0;
}
maeshun