結果

問題 No.781 円周上の格子点の数え上げ
コンテスト
ユーザー hedwig100
提出日時 2020-04-13 14:30:48
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 587 ms / 2,000 ms
コード長 664 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 131 ms
コンパイル使用メモリ 85,248 KB
実行使用メモリ 158,592 KB
最終ジャッジ日時 2026-04-12 02:53:28
合計ジャッジ時間 3,106 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)

def main():
    x,y = map(int,input().split())
    square = []
    for i in range(10000):
        if i * i <= y:
            square.append(i * i)
    
    cnt = [0] * (y + 1)
    for q1 in square:
        for q2 in square:
            if x <= q1 + q2 <= y:
                if q1 == 0 or q2 == 0:
                    cnt[q1 + q2] += 2
                else:
                    cnt[q1 + q2] += 4
    
    ans = 0
    for i in range(x,y + 1):
        ans = max(ans,cnt[i])
    
    #print(cnt,square)
    print(ans)

if __name__ =='__main__':
    main()   
0