結果
問題 | No.800 四平方定理 |
ユーザー | lloyz |
提出日時 | 2022-11-03 13:22:13 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 444 bytes |
コンパイル時間 | 2,244 ms |
コンパイル使用メモリ | 86,712 KB |
実行使用メモリ | 257,016 KB |
最終ジャッジ日時 | 2023-09-24 22:51:14 |
合計ジャッジ時間 | 28,140 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 110 ms
78,664 KB |
testcase_01 | AC | 143 ms
81,612 KB |
testcase_02 | AC | 126 ms
79,996 KB |
testcase_03 | AC | 126 ms
80,184 KB |
testcase_04 | AC | 124 ms
79,840 KB |
testcase_05 | AC | 130 ms
80,368 KB |
testcase_06 | AC | 147 ms
82,412 KB |
testcase_07 | AC | 132 ms
80,448 KB |
testcase_08 | AC | 112 ms
82,252 KB |
testcase_09 | AC | 140 ms
81,608 KB |
testcase_10 | AC | 1,781 ms
239,168 KB |
testcase_11 | TLE | - |
testcase_12 | AC | 1,965 ms
241,648 KB |
testcase_13 | AC | 1,783 ms
239,696 KB |
testcase_14 | AC | 1,936 ms
255,052 KB |
testcase_15 | TLE | - |
testcase_16 | AC | 1,970 ms
256,212 KB |
testcase_17 | AC | 1,976 ms
257,016 KB |
testcase_18 | TLE | - |
testcase_19 | TLE | - |
testcase_20 | AC | 72 ms
71,092 KB |
testcase_21 | AC | 69 ms
71,104 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 | -- | - |
ソースコード
from bisect import bisect_left, bisect_right def main(): n, d = map(int, input().split()) L = [] for w in range(1, n + 1): for z in range(1, n + 1): L.append(w**2 - z**2) L.sort() ans = 0 for x in range(1, n + 1): for y in range(1, n + 1): res = x**2 + y**2 - d ans += bisect_right(L, res) - bisect_left(L, res) print(ans) if __name__ == '__main__': main()