結果

問題 No.800 四平方定理
ユーザー ntk-ta01ntk-ta01
提出日時 2020-08-01 15:02:37
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 431 bytes
コンパイル時間 244 ms
コンパイル使用メモリ 86,944 KB
実行使用メモリ 373,108 KB
最終ジャッジ日時 2023-09-22 10:38:29
合計ジャッジ時間 29,148 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
80,596 KB
testcase_01 AC 124 ms
86,660 KB
testcase_02 AC 117 ms
83,556 KB
testcase_03 AC 119 ms
84,264 KB
testcase_04 AC 116 ms
82,908 KB
testcase_05 AC 118 ms
84,328 KB
testcase_06 AC 127 ms
88,192 KB
testcase_07 AC 123 ms
84,948 KB
testcase_08 AC 124 ms
88,132 KB
testcase_09 AC 122 ms
86,616 KB
testcase_10 AC 866 ms
259,672 KB
testcase_11 AC 968 ms
270,732 KB
testcase_12 AC 981 ms
261,712 KB
testcase_13 AC 932 ms
260,808 KB
testcase_14 AC 959 ms
269,684 KB
testcase_15 AC 996 ms
269,656 KB
testcase_16 AC 947 ms
269,952 KB
testcase_17 AC 950 ms
271,220 KB
testcase_18 AC 953 ms
270,644 KB
testcase_19 AC 979 ms
269,616 KB
testcase_20 AC 91 ms
71,644 KB
testcase_21 AC 92 ms
71,724 KB
testcase_22 AC 996 ms
270,516 KB
testcase_23 TLE -
testcase_24 AC 1,975 ms
372,308 KB
testcase_25 AC 1,995 ms
371,556 KB
testcase_26 AC 91 ms
71,732 KB
testcase_27 AC 89 ms
71,288 KB
testcase_28 AC 1,944 ms
372,604 KB
testcase_29 AC 1,988 ms
371,280 KB
testcase_30 AC 1,906 ms
373,108 KB
testcase_31 AC 1,636 ms
356,088 KB
testcase_32 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N, D = (int(i) for i in input().split())

    A = []
    for x in range(1, N+1):
        for y in range(1, N+1):
            A.append(x**2 + y**2)
    B = []
    for z in range(1, N+1):
        for w in range(1, N+1):
            B.append(z**2 - w**2)

    from collections import Counter
    ans = 0
    cB = Counter(B)
    for a in A:
        ans += cB[D-a]
    print(ans)


if __name__ == '__main__':
    main()
0