結果

問題 No.781 円周上の格子点の数え上げ
ユーザー prd_xxxprd_xxx
提出日時 2019-01-11 22:11:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 406 bytes
コンパイル時間 344 ms
コンパイル使用メモリ 82,376 KB
実行使用メモリ 83,952 KB
最終ジャッジ日時 2024-05-07 14:16:13
合計ジャッジ時間 5,033 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

X,Y = map(int,input().split())
arr = []
a = 1
while a*a <= Y:
    arr.append(a*a)
    a += 1
print(arr)
def calc(n):
    ret = 0
    for a in arr:
        i = bisect.bisect_left(arr, n-a)
        j = bisect.bisect(arr, n-a)
        ret += j-i
    if n**0.5 == int(n**0.5):
        ret += 1
    return ret * 4

ans = 0
for n in range(max(X,Y-3000),Y+1):
    ans = max(ans, calc(n))
print(ans)
0