結果
| 問題 | No.781 円周上の格子点の数え上げ | 
| コンテスト | |
| ユーザー |  lam6er | 
| 提出日時 | 2025-04-15 22:57:55 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,252 bytes | 
| コンパイル時間 | 491 ms | 
| コンパイル使用メモリ | 81,988 KB | 
| 実行使用メモリ | 161,820 KB | 
| 最終ジャッジ日時 | 2025-04-15 22:59:23 | 
| 合計ジャッジ時間 | 7,046 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 12 TLE * 2 -- * 7 | 
ソースコード
def main():
    import sys
    input = sys.stdin.read().split()
    X = int(input[0])
    Y = int(input[1])
    
    max_n = Y
    sieve = list(range(max_n + 1))  # Initialize sieve
    
    for i in range(2, int(max_n**0.5) + 1):
        if sieve[i] == i:  # i is a prime
            for j in range(i * i, max_n + 1, i):
                if sieve[j] == j:
                    sieve[j] = i
    
    max_val = 0
    
    for R in range(X, Y + 1):
        if R == 0:
            continue
        n = R
        factors = []
        if n == 1:
            factors = []
        else:
            while n != 1:
                p = sieve[n]
                count = 0
                while n % p == 0:
                    count += 1
                    n = n // p
                factors.append((p, count))
        
        valid = True
        product = 1
        for (p, e) in factors:
            if p % 4 == 3:
                if e % 2 != 0:
                    valid = False
                    break
            elif p % 4 == 1:
                product *= (e + 1)
        
        if valid:
            current = 4 * product
            if current > max_val:
                max_val = current
    
    print(max_val)
if __name__ == "__main__":
    main()
            
            
            
        