結果

問題 No.781 円周上の格子点の数え上げ
コンテスト
ユーザー lloyz
提出日時 2022-06-01 22:45:04
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 1,133 ms / 2,000 ms
+ 444µs
コード長 637 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 229 ms
コンパイル使用メモリ 96,116 KB
実行使用メモリ 285,552 KB
最終ジャッジ日時 2026-09-01 08:45:08
合計ジャッジ時間 5,614 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from collections import defaultdict

x, y = map(int, input().split())
ans = 0

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] < x:
            continue
        if Sq[i] + Sq[j] > y:
            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
        ans = max(ans, PointCounter[Sq[i] + Sq[j]])

print(ans)
0