結果

問題 No.2500 Products in a Range
ユーザー rlangevinrlangevin
提出日時 2023-10-13 21:41:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 960 bytes
コンパイル時間 571 ms
コンパイル使用メモリ 86,704 KB
実行使用メモリ 82,772 KB
最終ジャッジ日時 2023-10-13 21:42:12
合計ジャッジ時間 30,621 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,356 KB
testcase_01 AC 75 ms
71,268 KB
testcase_02 AC 163 ms
78,244 KB
testcase_03 AC 119 ms
77,148 KB
testcase_04 AC 137 ms
77,508 KB
testcase_05 AC 160 ms
78,000 KB
testcase_06 AC 107 ms
76,460 KB
testcase_07 AC 327 ms
79,552 KB
testcase_08 AC 1,050 ms
82,520 KB
testcase_09 AC 211 ms
78,972 KB
testcase_10 AC 777 ms
81,592 KB
testcase_11 AC 959 ms
81,736 KB
testcase_12 AC 459 ms
81,260 KB
testcase_13 AC 171 ms
77,964 KB
testcase_14 AC 1,071 ms
81,916 KB
testcase_15 AC 206 ms
78,408 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 1,091 ms
82,772 KB
testcase_23 AC 837 ms
81,408 KB
testcase_24 AC 1,068 ms
81,920 KB
testcase_25 AC 1,398 ms
81,812 KB
testcase_26 AC 1,401 ms
81,876 KB
testcase_27 AC 1,378 ms
81,868 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 386 ms
81,360 KB
testcase_34 AC 803 ms
82,052 KB
testcase_35 AC 74 ms
71,472 KB
testcase_36 AC 75 ms
71,040 KB
testcase_37 AC 76 ms
71,060 KB
testcase_38 AC 74 ms
71,380 KB
testcase_39 AC 76 ms
71,424 KB
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 75 ms
71,200 KB
testcase_43 WA -
testcase_44 AC 79 ms
76,188 KB
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 1,307 ms
82,084 KB
testcase_48 WA -
testcase_49 WA -
testcase_50 AC 484 ms
81,044 KB
testcase_51 AC 587 ms
81,684 KB
testcase_52 AC 882 ms
82,224 KB
testcase_53 AC 302 ms
80,152 KB
testcase_54 AC 92 ms
76,556 KB
testcase_55 AC 448 ms
79,788 KB
testcase_56 AC 488 ms
79,792 KB
testcase_57 AC 814 ms
80,812 KB
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import *

N, l, r = map(int, input().split())
B = sorted(list(map(int, input().split())))
A = []
zero = 0
for b in B:
    if b == 0:
        zero += 1
        N -= 1
    else:
        A.append(b)
        
def f(a):
    if a > 0:
        return (l + a - 1)//a, r//a
    else:
        return (-r -a - 1)//(-a), (-l)//(-a)

ans = 0
D = dict()
for a in A:
    mi, ma = f(a)
    D[a] = bisect_right(A, a)
    D[mi] = bisect_right(A, mi)
    D[ma] = bisect_right(A, ma)
    D[a-1] = bisect_right(A, a-1)
    D[mi-1] = bisect_right(A, mi-1)
    D[ma-1] = bisect_right(A, ma-1)


for i in range(N):
    for j in range(i + 1, N):
        mi1, ma1 = f(A[i])
        mi2, ma2 = f(A[j])
        mi = max(mi1, mi2, A[i]) - 1
        ma = min(ma1, ma2, A[j])
        cnt = int(A[i] <= mi) + int(A[j] > ma)
        if not (l <= A[i] * A[j] <= r):
            continue
        ans = max(ans, D[ma] - D[mi] + cnt)
        
if l <= 0 <= r:
    ans += zero
print(ans)
0