結果

問題 No.2510 Six Cube Sum Counting
ユーザー SSRSSSRS
提出日時 2023-10-20 21:35:13
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 683 bytes
コンパイル時間 2,050 ms
コンパイル使用メモリ 211,316 KB
実行使用メモリ 489,692 KB
最終ジャッジ日時 2023-10-20 21:35:27
合計ジャッジ時間 12,860 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const int MAX = 300;
int main(){
  int X;
  cin >> X;
  vector<unordered_map<int, int>> L(MAX + 1), R(MAX + 1);
  for (int i = 0; i <= MAX; i++){
    for (int j = i; j <= MAX; j++){
      for (int k = j; k <= MAX; k++){
        int s = i * i * i + j * j * j + k * k * k;
        L[k][s]++;
        R[i][s]++;
      }
    }
  }
  int ans = 0;
  unordered_map<int, int> mp;
  for (int i = 0; i <= MAX; i++){
    for (pair<int, int> P : L[i]){
      mp[P.first] += P.second;
    }
    for (pair<int, int> P : R[i]){
      if (mp.count(X - P.first) != 0){
        ans += mp[X - P.first] * P.second;
      }
    }
  }
  cout << ans << endl;
}
0