結果

問題 No.800 四平方定理
ユーザー titiatitia
提出日時 2019-03-17 22:05:28
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 338 bytes
コンパイル時間 319 ms
コンパイル使用メモリ 87,000 KB
実行使用メモリ 464,940 KB
最終ジャッジ日時 2023-09-22 06:29:54
合計ジャッジ時間 21,360 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
464,940 KB
testcase_01 AC 138 ms
86,800 KB
testcase_02 AC 122 ms
83,716 KB
testcase_03 AC 124 ms
84,844 KB
testcase_04 AC 120 ms
83,124 KB
testcase_05 AC 124 ms
84,488 KB
testcase_06 AC 135 ms
89,892 KB
testcase_07 AC 128 ms
86,008 KB
testcase_08 AC 134 ms
89,904 KB
testcase_09 AC 131 ms
87,248 KB
testcase_10 AC 1,247 ms
270,816 KB
testcase_11 AC 1,325 ms
268,596 KB
testcase_12 AC 1,500 ms
271,564 KB
testcase_13 AC 1,363 ms
262,304 KB
testcase_14 AC 1,419 ms
268,568 KB
testcase_15 AC 1,445 ms
268,296 KB
testcase_16 AC 1,429 ms
272,748 KB
testcase_17 AC 1,357 ms
272,476 KB
testcase_18 AC 1,368 ms
271,376 KB
testcase_19 AC 1,314 ms
271,236 KB
testcase_20 AC 89 ms
71,276 KB
testcase_21 AC 91 ms
71,572 KB
testcase_22 AC 1,368 ms
272,620 KB
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

P=[0]*(N*N)
M=[0]*(N*N)

for i in range(1,N+1):
    for j in range(i,N+1):
        P[(i-1)*N+j-1]=P[i-1+N*(j-1)]=i*i+j*j
        M[(i-1)*N+j-1]=i*i-j*j
        M[i-1+N*(j-1)]=-M[(i-1)*N+j-1]


from collections import Counter
PC=Counter(P)
MC=Counter(M)

ANS=0

for p in PC:
    ANS+=PC[p]*MC[p-D]

print(ANS)
0