結果
問題 |
No.781 円周上の格子点の数え上げ
|
ユーザー |
![]() |
提出日時 | 2025-03-31 17:28:22 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,129 bytes |
コンパイル時間 | 205 ms |
コンパイル使用メモリ | 82,124 KB |
実行使用メモリ | 154,624 KB |
最終ジャッジ日時 | 2025-03-31 17:30:04 |
合計ジャッジ時間 | 8,866 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 TLE * 1 |
ソースコード
def main(): import sys input = sys.stdin.read().split() X = int(input[0]) Y = int(input[1]) if Y == 0: print(0) return # Build min_prime_factor array up to Y max_Y = Y mpf = list(range(max_Y + 1)) for i in range(2, int(max_Y**0.5) + 1): if mpf[i] == i: # i is a prime for j in range(i * i, max_Y + 1, i): if mpf[j] == j: mpf[j] = i max_f = 0 for r in range(X, Y + 1): current = r valid = True product = 1 tmp = current while tmp > 1: p = mpf[tmp] count = 0 while tmp % p == 0: count += 1 tmp //= p if p % 4 == 3: if count % 2 != 0: valid = False break else: if p % 4 == 1: product *= (count + 1) if valid: current_f = 4 * product if current_f > max_f: max_f = current_f print(max_f) if __name__ == "__main__": main()