結果
問題 | No.781 円周上の格子点の数え上げ |
ユーザー | prd_xxx |
提出日時 | 2019-01-11 21:49:56 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 384 bytes |
コンパイル時間 | 437 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 81,920 KB |
最終ジャッジ日時 | 2024-05-07 12:52:35 |
合計ジャッジ時間 | 5,739 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 38 ms
57,600 KB |
testcase_01 | AC | 39 ms
51,968 KB |
testcase_02 | AC | 38 ms
52,352 KB |
testcase_03 | AC | 36 ms
51,712 KB |
testcase_04 | AC | 37 ms
51,840 KB |
testcase_05 | AC | 37 ms
51,712 KB |
testcase_06 | AC | 53 ms
58,880 KB |
testcase_07 | AC | 49 ms
59,776 KB |
testcase_08 | AC | 69 ms
69,376 KB |
testcase_09 | AC | 64 ms
69,504 KB |
testcase_10 | AC | 714 ms
76,672 KB |
testcase_11 | TLE | - |
testcase_12 | TLE | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
ソースコード
import bisect X,Y = map(int,input().split()) arr = [] a = 1 while a*a <= Y: arr.append(a*a) a += 1 def calc(n): ret = 0 for a in arr: i = bisect.bisect_left(arr, n-a) j = bisect.bisect(arr, n-a) ret += j-i if n**0.5 == int(n**0.5): ret += 1 return ret * 4 ans = 0 for n in range(X,Y+1): ans = max(ans, calc(n)) print(ans)