結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,608 KB
testcase_01 AC 33 ms
52,480 KB
testcase_02 AC 34 ms
52,352 KB
testcase_03 AC 35 ms
52,736 KB
testcase_04 AC 34 ms
52,224 KB
testcase_05 AC 33 ms
52,096 KB
testcase_06 AC 40 ms
59,264 KB
testcase_07 AC 43 ms
60,032 KB
testcase_08 AC 53 ms
69,888 KB
testcase_09 AC 55 ms
70,272 KB
testcase_10 AC 134 ms
76,416 KB
testcase_11 WA -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 WA -
testcase_15 AC 102 ms
76,032 KB
testcase_16 AC 43 ms
60,288 KB
testcase_17 WA -
testcase_18 AC 97 ms
76,544 KB
testcase_19 AC 72 ms
76,160 KB
testcase_20 AC 66 ms
75,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

X,Y = map(int,input().split())
arr = []
a = 1
while a*a <= Y:
    arr.append(a*a)
    a += 1

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-2000),Y+1):
    ans = max(ans, calc(n))
print(ans)
0