結果

問題 No.800 四平方定理
ユーザー H3PO4H3PO4
提出日時 2021-02-07 10:38:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 358 bytes
コンパイル時間 220 ms
コンパイル使用メモリ 87,220 KB
実行使用メモリ 264,288 KB
最終ジャッジ日時 2023-09-17 01:22:12
合計ジャッジ時間 9,875 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
77,996 KB
testcase_01 AC 76 ms
79,448 KB
testcase_02 AC 70 ms
78,492 KB
testcase_03 AC 68 ms
78,708 KB
testcase_04 AC 68 ms
78,352 KB
testcase_05 AC 71 ms
78,824 KB
testcase_06 AC 71 ms
80,128 KB
testcase_07 AC 75 ms
79,432 KB
testcase_08 WA -
testcase_09 AC 72 ms
79,760 KB
testcase_10 AC 286 ms
169,812 KB
testcase_11 AC 320 ms
181,228 KB
testcase_12 AC 323 ms
179,388 KB
testcase_13 AC 264 ms
174,084 KB
testcase_14 AC 266 ms
181,148 KB
testcase_15 AC 315 ms
180,432 KB
testcase_16 AC 286 ms
182,380 KB
testcase_17 AC 286 ms
182,104 KB
testcase_18 AC 325 ms
181,924 KB
testcase_19 AC 332 ms
181,980 KB
testcase_20 AC 63 ms
71,336 KB
testcase_21 AC 64 ms
71,332 KB
testcase_22 AC 345 ms
182,388 KB
testcase_23 AC 563 ms
264,164 KB
testcase_24 AC 516 ms
264,288 KB
testcase_25 AC 526 ms
263,496 KB
testcase_26 AC 61 ms
71,336 KB
testcase_27 RE -
testcase_28 AC 535 ms
263,408 KB
testcase_29 AC 530 ms
263,960 KB
testcase_30 AC 468 ms
263,520 KB
testcase_31 AC 454 ms
250,416 KB
testcase_32 AC 559 ms
264,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

N, D = map(int, input().split())

sq = tuple(i ** 2 for i in range(1, N + 1))
xy, zw = [0] * (3 * N ** 2), [0] * (3 * N ** 2)
for i, j in itertools.combinations(sq, 2):
    xy[i + j] += 2
    zw[i - j] += 1
    zw[j - i] += 1
for i in sq:
    xy[2 * i] += 1
zw[0] += N
ans = 0
for i, a in enumerate(xy):
    ans += a * zw[i - D]
print(ans)
0