結果

問題 No.2510 Six Cube Sum Counting
ユーザー Nzt3Nzt3
提出日時 2023-10-21 00:09:50
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 221 ms / 4,000 ms
コード長 736 bytes
コンパイル時間 12,490 ms
コンパイル使用メモリ 206,252 KB
実行使用メモリ 126,292 KB
最終ジャッジ日時 2023-10-21 00:10:22
合計ジャッジ時間 10,006 ms
ジャッジサーバーID
(参考情報)
judge9 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 164 ms
126,292 KB
testcase_01 AC 161 ms
126,292 KB
testcase_02 AC 190 ms
126,292 KB
testcase_03 AC 159 ms
126,292 KB
testcase_04 AC 194 ms
126,292 KB
testcase_05 AC 185 ms
126,292 KB
testcase_06 AC 180 ms
126,292 KB
testcase_07 AC 158 ms
126,292 KB
testcase_08 AC 170 ms
126,292 KB
testcase_09 AC 157 ms
126,292 KB
testcase_10 AC 187 ms
126,292 KB
testcase_11 AC 158 ms
126,292 KB
testcase_12 AC 177 ms
126,292 KB
testcase_13 AC 165 ms
126,292 KB
testcase_14 AC 161 ms
126,292 KB
testcase_15 AC 159 ms
126,292 KB
testcase_16 AC 214 ms
126,292 KB
testcase_17 AC 162 ms
126,292 KB
testcase_18 AC 161 ms
126,292 KB
testcase_19 AC 185 ms
126,292 KB
testcase_20 AC 221 ms
126,292 KB
testcase_21 AC 209 ms
126,292 KB
testcase_22 AC 189 ms
126,292 KB
testcase_23 AC 183 ms
126,292 KB
testcase_24 AC 195 ms
126,292 KB
testcase_25 AC 191 ms
126,292 KB
testcase_26 AC 199 ms
126,292 KB
testcase_27 AC 197 ms
126,292 KB
testcase_28 AC 163 ms
126,292 KB
testcase_29 AC 197 ms
126,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
char cntA[300*300*300*3+1];
char cntB[300*300*300*3+1];

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  time_t c=clock();
  int X;
  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(X-j>=0&&X-j<300*300*300*3+1)
      ans+=cntB[X-j];
    }
    for(int j:D[i]){
      cntB[j]-=1;
    }
  }
  cout<<ans<<'\n';
}
0