結果

問題 No.781 円周上の格子点の数え上げ
ユーザー shotoyooshotoyoo
提出日時 2021-05-25 23:33:20
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 842 bytes
コンパイル時間 454 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 216,832 KB
最終ジャッジ日時 2024-04-22 15:12:34
合計ジャッジ時間 3,905 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 38 ms
52,224 KB
testcase_02 AC 38 ms
52,096 KB
testcase_03 WA -
testcase_04 AC 41 ms
52,224 KB
testcase_05 WA -
testcase_06 AC 50 ms
60,032 KB
testcase_07 AC 45 ms
59,904 KB
testcase_08 AC 284 ms
137,984 KB
testcase_09 AC 279 ms
137,856 KB
testcase_10 AC 43 ms
58,880 KB
testcase_11 AC 44 ms
60,416 KB
testcase_12 AC 321 ms
181,120 KB
testcase_13 AC 351 ms
216,832 KB
testcase_14 AC 52 ms
64,768 KB
testcase_15 AC 43 ms
58,496 KB
testcase_16 AC 47 ms
58,240 KB
testcase_17 AC 219 ms
152,448 KB
testcase_18 AC 174 ms
105,984 KB
testcase_19 AC 176 ms
107,648 KB
testcase_20 AC 177 ms
107,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda : sys.stdin.readline().rstrip()

sys.setrecursionlimit(2*10**5+10)
write = lambda x: sys.stdout.write(x+"\n")
debug = lambda x: sys.stderr.write(x+"\n")
writef = lambda x: print("{:.12f}".format(x))

x,y = list(map(int, input().split()))
eps = 10**-7
def isqrt(n):
    """x*x<=nなる最大のx
    """
    x,y = n, (n+1)//2
    while y<x:
        x,y = y, (y + n//y) // 2
    return x
def sub(x):
    ans = 0
    for v in range(x):
        vv = x - v*v
        if vv<=0:
            break
        if (int((vv**0.5)+eps)**2 - vv) == 0:
            ans += 4
#             print(v,vv)
    return ans
vals = [0]*(y+1)
for v in range(4000):
    if v*v>y:
        break
    v2 = v*v
    for u in range(4000):
        u2 = u*u
        if v2 + u2>y:
            break
        vals[v2+u2] += 4
ans = max(vals[x:])
print(ans)
0