結果

問題 No.2510 Six Cube Sum Counting
ユーザー Nzt3Nzt3
提出日時 2023-10-20 23:39:04
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 884 ms / 4,000 ms
コード長 795 bytes
コンパイル時間 3,946 ms
コンパイル使用メモリ 236,088 KB
実行使用メモリ 193,128 KB
最終ジャッジ日時 2023-10-20 23:39:36
合計ジャッジ時間 30,720 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 804 ms
193,128 KB
testcase_01 AC 824 ms
193,120 KB
testcase_02 AC 831 ms
193,120 KB
testcase_03 AC 801 ms
193,120 KB
testcase_04 AC 834 ms
193,120 KB
testcase_05 AC 788 ms
193,120 KB
testcase_06 AC 829 ms
193,120 KB
testcase_07 AC 849 ms
193,120 KB
testcase_08 AC 795 ms
193,120 KB
testcase_09 AC 849 ms
193,120 KB
testcase_10 AC 842 ms
193,120 KB
testcase_11 AC 789 ms
193,120 KB
testcase_12 AC 844 ms
193,120 KB
testcase_13 AC 808 ms
193,120 KB
testcase_14 AC 864 ms
193,120 KB
testcase_15 AC 847 ms
193,120 KB
testcase_16 AC 808 ms
193,120 KB
testcase_17 AC 828 ms
193,120 KB
testcase_18 AC 857 ms
193,120 KB
testcase_19 AC 800 ms
193,120 KB
testcase_20 AC 835 ms
193,120 KB
testcase_21 AC 824 ms
193,120 KB
testcase_22 AC 805 ms
193,120 KB
testcase_23 AC 823 ms
193,120 KB
testcase_24 AC 833 ms
193,120 KB
testcase_25 AC 812 ms
193,120 KB
testcase_26 AC 884 ms
193,120 KB
testcase_27 AC 822 ms
193,120 KB
testcase_28 AC 804 ms
193,120 KB
testcase_29 AC 830 ms
193,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using ll=long long;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  time_t c=clock();
  int X;
  __gnu_pbds::gp_hash_table<int,int>cntA,cntB;
  cin>>X;
  vector C(301,vector(0,0)),D(301,vector(0,0));
  for(int i=0;i<=300;i++){
    for(int j=i;j<=300;j++){
      for(int k=j;k<=300;k++){
        int t=i*i*i+j*j*j+k*k*k;
        C[k].push_back(t);
        D[i].push_back(t);
      }
    }
  }
  for(int i=0;i<=300;i++){
    for(int j:C[i]){
      cntB[j]+=1;
    }
  }
  int ans=0;
  for(int i=0;i<=300;i++){
    for(int j:C[i]){
      if(cntB.find(X-j)!=cntB.end())ans+=cntB[X-j];
    }
    for(int j:D[i]){
      cntB[j]-=1;
    }
  }
  cout<<ans<<'\n';
}
0