結果

問題 No.800 四平方定理
ユーザー kamojirokamojiro
提出日時 2019-03-17 23:49:21
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 349 bytes
コンパイル時間 887 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 209,600 KB
最終ジャッジ日時 2023-09-22 15:45:02
合計ジャッジ時間 8,517 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 150 ms
208,676 KB
testcase_01 AC 152 ms
208,972 KB
testcase_02 AC 154 ms
209,084 KB
testcase_03 AC 156 ms
209,364 KB
testcase_04 AC 156 ms
209,104 KB
testcase_05 AC 154 ms
209,400 KB
testcase_06 AC 155 ms
209,088 KB
testcase_07 AC 155 ms
209,268 KB
testcase_08 AC 165 ms
209,124 KB
testcase_09 AC 152 ms
209,208 KB
testcase_10 AC 205 ms
209,392 KB
testcase_11 AC 212 ms
209,256 KB
testcase_12 AC 209 ms
208,996 KB
testcase_13 AC 206 ms
208,884 KB
testcase_14 AC 210 ms
209,168 KB
testcase_15 AC 214 ms
209,088 KB
testcase_16 AC 210 ms
209,196 KB
testcase_17 AC 212 ms
209,060 KB
testcase_18 AC 214 ms
209,256 KB
testcase_19 AC 215 ms
209,108 KB
testcase_20 AC 142 ms
208,412 KB
testcase_21 AC 143 ms
208,428 KB
testcase_22 AC 215 ms
209,128 KB
testcase_23 WA -
testcase_24 AC 281 ms
209,132 KB
testcase_25 WA -
testcase_26 AC 144 ms
208,652 KB
testcase_27 AC 142 ms
208,688 KB
testcase_28 AC 289 ms
209,188 KB
testcase_29 WA -
testcase_30 AC 295 ms
209,132 KB
testcase_31 AC 285 ms
209,268 KB
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, D = map( int, input().split())
left = [0]*(8*(10**6)+1)
right = [0]*(9*(10**6)+1)
for i in range(1, N+1):
    for j in range(1, N+1):
        left[i**2 + j**2] += 1
for i in range(1, N+1):
    for j in range(1, N+1):
        right[i**2 - j**2 + D+4*10**6] += 1
ans = 0
for i in range(1, 4*10**6+1):
    ans += left[i]*right[i+4*10**6]
print(ans)
0