結果

問題 No.800 四平方定理
ユーザー ntk-ta01ntk-ta01
提出日時 2020-08-01 14:57:16
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 431 bytes
コンパイル時間 366 ms
コンパイル使用メモリ 87,208 KB
実行使用メモリ 372,576 KB
最終ジャッジ日時 2023-09-22 10:43:46
合計ジャッジ時間 33,169 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
80,868 KB
testcase_01 AC 135 ms
86,636 KB
testcase_02 AC 132 ms
83,844 KB
testcase_03 AC 131 ms
84,408 KB
testcase_04 AC 125 ms
82,996 KB
testcase_05 AC 127 ms
84,476 KB
testcase_06 AC 139 ms
88,556 KB
testcase_07 AC 135 ms
85,208 KB
testcase_08 AC 135 ms
88,356 KB
testcase_09 AC 133 ms
86,676 KB
testcase_10 AC 1,002 ms
259,460 KB
testcase_11 AC 1,069 ms
270,344 KB
testcase_12 AC 1,113 ms
261,924 KB
testcase_13 AC 1,071 ms
260,468 KB
testcase_14 AC 1,087 ms
269,992 KB
testcase_15 AC 1,088 ms
270,148 KB
testcase_16 AC 1,084 ms
271,220 KB
testcase_17 AC 1,165 ms
270,160 KB
testcase_18 AC 1,127 ms
271,160 KB
testcase_19 AC 1,167 ms
269,716 KB
testcase_20 AC 97 ms
71,900 KB
testcase_21 AC 93 ms
71,752 KB
testcase_22 AC 1,172 ms
270,172 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 AC 96 ms
71,688 KB
testcase_27 AC 96 ms
71,532 KB
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 AC 1,894 ms
356,284 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