結果
問題 | No.800 四平方定理 |
ユーザー | fine |
提出日時 | 2019-03-17 21:36:33 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 605 bytes |
コンパイル時間 | 1,634 ms |
コンパイル使用メモリ | 171,640 KB |
実行使用メモリ | 61,304 KB |
最終ジャッジ日時 | 2023-09-22 04:15:06 |
合計ジャッジ時間 | 25,031 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 10 ms
8,752 KB |
testcase_01 | AC | 20 ms
4,500 KB |
testcase_02 | AC | 15 ms
4,500 KB |
testcase_03 | AC | 16 ms
4,380 KB |
testcase_04 | AC | 14 ms
4,380 KB |
testcase_05 | AC | 16 ms
4,376 KB |
testcase_06 | AC | 23 ms
4,680 KB |
testcase_07 | AC | 19 ms
4,388 KB |
testcase_08 | AC | 17 ms
5,008 KB |
testcase_09 | AC | 21 ms
4,544 KB |
testcase_10 | AC | 1,647 ms
30,436 KB |
testcase_11 | AC | 1,784 ms
33,688 KB |
testcase_12 | AC | 1,812 ms
33,508 KB |
testcase_13 | AC | 1,449 ms
32,000 KB |
testcase_14 | AC | 1,613 ms
34,004 KB |
testcase_15 | AC | 1,867 ms
33,564 KB |
testcase_16 | AC | 1,638 ms
34,260 KB |
testcase_17 | AC | 1,568 ms
34,180 KB |
testcase_18 | AC | 1,989 ms
33,964 KB |
testcase_19 | TLE | - |
testcase_20 | AC | 2 ms
4,376 KB |
testcase_21 | AC | 2 ms
4,376 KB |
testcase_22 | AC | 1,963 ms
34,036 KB |
testcase_23 | TLE | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, d; cin >> n >> d; map<int, int> m; for (int x = 1; x <= n; x++) { for (int y = 1; y <= n; y++) { int val = x * x + y * y; m[val]++; } } ll ans = 0; for (int z = 1; z <= n; z++) { for (int w = 1; w <= n; w++) { int val = d + w * w - z * z; if (m.find(val) == m.end()) continue; ans += m[val]; } } cout << ans << endl; return 0; }