結果

問題 No.781 円周上の格子点の数え上げ
ユーザー lloyz
提出日時 2022-06-01 22:40:29
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 599 bytes
コンパイル時間 204 ms
コンパイル使用メモリ 82,364 KB
実行使用メモリ 445,064 KB
最終ジャッジ日時 2024-09-21 01:45:09
合計ジャッジ時間 30,027 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12 TLE * 1 -- * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

Sq = [i**2 for i in range(3201)]
PointCounter = defaultdict(int)
for i in range(3201):
    for j in range(i, 3201):
        if Sq[i] + Sq[j] > 10**7:
            break
        if i == j:
            if i == 0:
                continue
            else:
                PointCounter[Sq[i] + Sq[j]] += 4
        else:
            if i == 0:
                PointCounter[Sq[j]] += 4
            else:
                PointCounter[Sq[i] + Sq[j]] += 8

x, y = map(int, input().split())
ans = 0
for i in range(x, y + 1):
    ans = max(ans, PointCounter[i])
print(ans)
0