結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
92,988 KB
testcase_01 AC 89 ms
94,132 KB
testcase_02 AC 84 ms
93,276 KB
testcase_03 AC 80 ms
93,524 KB
testcase_04 AC 86 ms
93,276 KB
testcase_05 AC 86 ms
93,836 KB
testcase_06 AC 81 ms
94,536 KB
testcase_07 AC 87 ms
93,900 KB
testcase_08 AC 88 ms
94,692 KB
testcase_09 AC 79 ms
93,984 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 76 ms
91,644 KB
testcase_21 AC 74 ms
91,588 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 75 ms
91,424 KB
testcase_27 AC 72 ms
91,492 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

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

sq = tuple(i ** 2 for i in range(1, N + 1))
xy, zw = ([0] * (2 * N ** 2 + 10 ** 6) for _ in range(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