結果

問題 No.800 四平方定理
ユーザー kyo1kyo1
提出日時 2020-06-18 21:48:45
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 448 bytes
コンパイル時間 2,196 ms
コンパイル使用メモリ 203,216 KB
実行使用メモリ 168,760 KB
最終ジャッジ日時 2023-09-16 12:27:26
合計ジャッジ時間 24,487 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
4,572 KB
testcase_01 AC 14 ms
5,660 KB
testcase_02 AC 11 ms
5,512 KB
testcase_03 AC 13 ms
5,552 KB
testcase_04 AC 9 ms
4,752 KB
testcase_05 AC 11 ms
5,516 KB
testcase_06 AC 17 ms
5,984 KB
testcase_07 AC 13 ms
5,464 KB
testcase_08 AC 18 ms
6,264 KB
testcase_09 AC 15 ms
5,648 KB
testcase_10 AC 883 ms
58,724 KB
testcase_11 AC 1,221 ms
82,592 KB
testcase_12 AC 1,202 ms
82,456 KB
testcase_13 AC 1,161 ms
82,456 KB
testcase_14 AC 1,283 ms
82,584 KB
testcase_15 AC 1,290 ms
82,668 KB
testcase_16 AC 1,264 ms
82,504 KB
testcase_17 AC 1,283 ms
82,516 KB
testcase_18 AC 1,177 ms
82,472 KB
testcase_19 AC 1,213 ms
82,516 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 1,264 ms
82,528 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 AC 2 ms
4,384 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, D;
  cin >> N >> D;
  unordered_map<int, int> mp;
  for (int x = 1; x < N + 1; x++) {
    for (int y = 1; y < N + 1; y++) {
      mp[x * x + y * y]++;
    }
  }
  int res = 0;
  for (int z = 1; z < N + 1; z++) {
    for (int w = 1; w < N + 1; w++) {
      res += mp[D + w * w - z * z];
    }
  }
  cout << res << '\n';
  return 0;
}
0