結果

問題 No.800 四平方定理
ユーザー hedwig100hedwig100
提出日時 2020-04-24 10:52:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 323 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 168,220 KB
最終ジャッジ日時 2024-04-23 02:25:33
合計ジャッジ時間 21,960 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 534 ms
44,640 KB
testcase_01 AC 532 ms
45,532 KB
testcase_02 AC 536 ms
44,628 KB
testcase_03 AC 529 ms
45,144 KB
testcase_04 AC 526 ms
44,880 KB
testcase_05 AC 535 ms
45,536 KB
testcase_06 AC 540 ms
45,784 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 539 ms
45,524 KB
testcase_10 AC 614 ms
105,464 KB
testcase_11 AC 629 ms
113,532 KB
testcase_12 AC 631 ms
111,964 KB
testcase_13 AC 615 ms
108,132 KB
testcase_14 AC 623 ms
112,972 KB
testcase_15 AC 634 ms
112,480 KB
testcase_16 AC 618 ms
114,088 KB
testcase_17 AC 626 ms
114,120 KB
testcase_18 AC 626 ms
113,440 KB
testcase_19 AC 632 ms
113,724 KB
testcase_20 AC 534 ms
44,384 KB
testcase_21 RE -
testcase_22 AC 632 ms
113,876 KB
testcase_23 AC 708 ms
168,220 KB
testcase_24 AC 697 ms
168,220 KB
testcase_25 AC 704 ms
167,656 KB
testcase_26 AC 536 ms
44,116 KB
testcase_27 RE -
testcase_28 AC 687 ms
167,480 KB
testcase_29 AC 710 ms
168,044 KB
testcase_30 AC 695 ms
167,544 KB
testcase_31 AC 692 ms
159,060 KB
testcase_32 AC 714 ms
167,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
def main():
    n,d = map(int,input().split())
    square = np.arange(1,n + 1) ** 2
    Add = np.bincount(np.add.outer(square,square).flatten())
    Sub = (square[:,None] - square[None,:]).flatten() + d
    Sub = Sub[Sub >= 0]
    ans = Add[Sub].sum()
    print(ans)
if __name__ =='__main__':
    main() 
0