結果
問題 | No.800 四平方定理 |
ユーザー | snrnsidy |
提出日時 | 2021-02-21 22:17:49 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 529 bytes |
コンパイル時間 | 3,529 ms |
コンパイル使用メモリ | 206,092 KB |
実行使用メモリ | 122,028 KB |
最終ジャッジ日時 | 2023-10-19 23:17:46 |
合計ジャッジ時間 | 28,500 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 8 ms
9,216 KB |
testcase_01 | AC | 17 ms
6,640 KB |
testcase_02 | AC | 10 ms
5,112 KB |
testcase_03 | AC | 12 ms
5,372 KB |
testcase_04 | AC | 11 ms
5,304 KB |
testcase_05 | AC | 13 ms
5,476 KB |
testcase_06 | AC | 19 ms
6,700 KB |
testcase_07 | AC | 21 ms
7,164 KB |
testcase_08 | AC | 32 ms
8,604 KB |
testcase_09 | AC | 15 ms
5,904 KB |
testcase_10 | AC | 1,665 ms
75,564 KB |
testcase_11 | AC | 1,786 ms
78,792 KB |
testcase_12 | AC | 1,993 ms
89,352 KB |
testcase_13 | AC | 1,466 ms
66,456 KB |
testcase_14 | AC | 1,619 ms
73,168 KB |
testcase_15 | AC | 1,967 ms
88,404 KB |
testcase_16 | AC | 1,739 ms
73,616 KB |
testcase_17 | AC | 1,599 ms
71,768 KB |
testcase_18 | TLE | - |
testcase_19 | TLE | - |
testcase_20 | AC | 2 ms
4,368 KB |
testcase_21 | AC | 2 ms
4,368 KB |
testcase_22 | TLE | - |
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; // x^2 + y^2과 w^2 - z^2를 구한다. unordered_map <int,int> cnt1,cnt2; int main(void) { cin.tie(0); ios::sync_with_stdio(false); int n,D; int res = 0; cin >> n >> D; for(int a=1;a<=n;a++) { for(int b=1;b<=n;b++) { cnt1[a*a + b*b]++; if(b*b - a*a + D>=0) { cnt2[b*b - a*a]++; } } } for(auto it : cnt2) { long long int way = it.second; long long int val = it.first + D; res += (cnt1[val]*way); } cout << res << '\n'; return 0; }