結果

問題 No.2510 Six Cube Sum Counting
ユーザー maeshunmaeshun
提出日時 2023-10-20 23:20:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,489 ms / 4,000 ms
コード長 1,487 bytes
コンパイル時間 8,879 ms
コンパイル使用メモリ 245,820 KB
実行使用メモリ 135,224 KB
最終ジャッジ日時 2023-10-20 23:22:18
合計ジャッジ時間 32,708 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 723 ms
135,224 KB
testcase_01 AC 697 ms
135,224 KB
testcase_02 AC 1,219 ms
135,224 KB
testcase_03 AC 752 ms
135,224 KB
testcase_04 AC 703 ms
135,224 KB
testcase_05 AC 729 ms
135,224 KB
testcase_06 AC 898 ms
135,224 KB
testcase_07 AC 755 ms
135,224 KB
testcase_08 AC 781 ms
135,224 KB
testcase_09 AC 780 ms
135,224 KB
testcase_10 AC 757 ms
135,224 KB
testcase_11 AC 788 ms
135,224 KB
testcase_12 AC 759 ms
135,224 KB
testcase_13 AC 791 ms
135,224 KB
testcase_14 AC 798 ms
135,224 KB
testcase_15 AC 704 ms
135,224 KB
testcase_16 AC 730 ms
135,224 KB
testcase_17 AC 700 ms
135,224 KB
testcase_18 AC 781 ms
135,224 KB
testcase_19 AC 779 ms
135,224 KB
testcase_20 AC 1,017 ms
135,224 KB
testcase_21 AC 1,223 ms
135,224 KB
testcase_22 AC 1,489 ms
135,224 KB
testcase_23 AC 1,226 ms
135,224 KB
testcase_24 AC 1,257 ms
135,224 KB
testcase_25 AC 783 ms
135,224 KB
testcase_26 AC 768 ms
135,224 KB
testcase_27 AC 972 ms
135,224 KB
testcase_28 AC 767 ms
135,224 KB
testcase_29 AC 1,268 ms
135,224 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
      |              ^

ソースコード

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<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;
}
0