結果

問題 No.800 四平方定理
ユーザー kamojirokamojiro
提出日時 2019-03-17 23:47:39
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
TLE  
実行時間 -
コード長 386 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 10,792 KB
実行使用メモリ 145,144 KB
最終ジャッジ日時 2023-09-22 15:40:40
合計ジャッジ時間 22,587 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,363 ms
140,688 KB
testcase_01 AC 1,373 ms
140,884 KB
testcase_02 AC 1,380 ms
140,860 KB
testcase_03 AC 1,343 ms
140,804 KB
testcase_04 AC 1,312 ms
140,828 KB
testcase_05 AC 1,401 ms
140,800 KB
testcase_06 AC 1,520 ms
140,700 KB
testcase_07 AC 1,394 ms
140,752 KB
testcase_08 AC 1,232 ms
140,668 KB
testcase_09 AC 1,289 ms
140,756 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
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())
left = [0]*(8*(10**6))
right = [0]*(9*(10**6))
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, 8*10**6+1):
    if i+4*10**6 > 8*10**6:
        break
    ans += left[i]*right[i+4*10**6]
print(ans)
0