結果

問題 No.2500 Products in a Range
ユーザー rlangevinrlangevin
提出日時 2023-10-13 21:57:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 968 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 83,004 KB
最終ジャッジ日時 2023-10-13 21:58:20
合計ジャッジ時間 30,355 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,560 KB
testcase_01 AC 71 ms
71,348 KB
testcase_02 AC 154 ms
78,192 KB
testcase_03 AC 112 ms
77,128 KB
testcase_04 AC 132 ms
77,656 KB
testcase_05 AC 157 ms
78,068 KB
testcase_06 AC 99 ms
77,056 KB
testcase_07 AC 325 ms
79,648 KB
testcase_08 AC 1,046 ms
83,004 KB
testcase_09 AC 209 ms
78,892 KB
testcase_10 AC 764 ms
82,080 KB
testcase_11 AC 945 ms
81,900 KB
testcase_12 AC 445 ms
81,192 KB
testcase_13 AC 166 ms
78,288 KB
testcase_14 AC 1,012 ms
81,660 KB
testcase_15 AC 205 ms
78,456 KB
testcase_16 AC 696 ms
80,808 KB
testcase_17 AC 414 ms
80,228 KB
testcase_18 AC 422 ms
80,440 KB
testcase_19 AC 862 ms
81,712 KB
testcase_20 AC 917 ms
81,252 KB
testcase_21 AC 237 ms
79,592 KB
testcase_22 AC 1,095 ms
82,712 KB
testcase_23 AC 843 ms
81,812 KB
testcase_24 AC 1,070 ms
82,196 KB
testcase_25 AC 1,391 ms
81,848 KB
testcase_26 AC 1,347 ms
81,880 KB
testcase_27 AC 1,349 ms
82,248 KB
testcase_28 AC 769 ms
80,492 KB
testcase_29 AC 259 ms
79,984 KB
testcase_30 AC 223 ms
78,600 KB
testcase_31 AC 137 ms
78,100 KB
testcase_32 AC 126 ms
77,516 KB
testcase_33 AC 387 ms
81,004 KB
testcase_34 AC 800 ms
81,976 KB
testcase_35 AC 69 ms
71,396 KB
testcase_36 AC 70 ms
71,592 KB
testcase_37 AC 74 ms
71,596 KB
testcase_38 AC 71 ms
71,552 KB
testcase_39 AC 71 ms
71,384 KB
testcase_40 AC 69 ms
71,452 KB
testcase_41 AC 72 ms
71,212 KB
testcase_42 AC 71 ms
71,496 KB
testcase_43 AC 72 ms
71,176 KB
testcase_44 WA -
testcase_45 AC 70 ms
71,356 KB
testcase_46 AC 74 ms
76,564 KB
testcase_47 AC 1,305 ms
81,892 KB
testcase_48 AC 97 ms
76,856 KB
testcase_49 AC 109 ms
77,032 KB
testcase_50 AC 491 ms
81,492 KB
testcase_51 AC 539 ms
81,712 KB
testcase_52 AC 866 ms
82,104 KB
testcase_53 AC 275 ms
80,812 KB
testcase_54 AC 90 ms
76,480 KB
testcase_55 AC 434 ms
79,392 KB
testcase_56 AC 446 ms
80,720 KB
testcase_57 AC 818 ms
80,776 KB
testcase_58 AC 228 ms
78,636 KB
testcase_59 AC 941 ms
81,240 KB
testcase_60 AC 170 ms
78,268 KB
権限があれば一括ダウンロードができます

ソースコード

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 = 1
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, max(0, D[ma] - D[mi]) + cnt)
        
if l <= 0 <= r:
    ans += zero
print(ans)
0