結果
問題 | No.800 四平方定理 |
ユーザー | Bwambocos |
提出日時 | 2019-03-17 23:26:20 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 465 bytes |
コンパイル時間 | 1,906 ms |
コンパイル使用メモリ | 173,056 KB |
実行使用メモリ | 28,964 KB |
最終ジャッジ日時 | 2023-09-22 11:26:08 |
合計ジャッジ時間 | 6,556 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 47 ms
14,344 KB |
testcase_01 | AC | 95 ms
23,200 KB |
testcase_02 | AC | 66 ms
17,560 KB |
testcase_03 | AC | 73 ms
19,272 KB |
testcase_04 | AC | 59 ms
16,436 KB |
testcase_05 | AC | 70 ms
18,508 KB |
testcase_06 | AC | 116 ms
27,236 KB |
testcase_07 | AC | 91 ms
20,624 KB |
testcase_08 | AC | 127 ms
28,964 KB |
testcase_09 | AC | 101 ms
24,292 KB |
testcase_10 | TLE | - |
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 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
ソースコード
#include "bits/stdc++.h" #define in std::cin #define out std::cout #define rep(i,N) for(LL i=0;i<N;++i) typedef long long int LL; int main() { LL N, D; in >> N >> D; std::map<LL, LL>cnt1, cnt2; for (LL x = 1; x <= N; ++x) for (LL y = 1; y <= N; ++y) ++cnt1[x*x + y * y]; for (LL w = 1; w <= N; ++w) for (LL z = 1; z <= N; ++z) ++cnt2[w*w - z * z + D]; LL ans = 0; for (LL i = 1; i <= 2 * N * N; ++i) ans += cnt1[i] * cnt2[i]; out << ans << std::endl; }