結果

問題 No.2500 Products in a Range
ユーザー flygonflygon
提出日時 2023-10-13 21:56:07
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 994 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 79,528 KB
最終ジャッジ日時 2023-10-13 21:56:25
合計ジャッジ時間 18,149 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,780 KB
testcase_01 AC 93 ms
71,768 KB
testcase_02 AC 140 ms
78,276 KB
testcase_03 AC 129 ms
77,588 KB
testcase_04 AC 150 ms
78,544 KB
testcase_05 AC 160 ms
77,856 KB
testcase_06 AC 115 ms
77,436 KB
testcase_07 AC 274 ms
78,340 KB
testcase_08 AC 1,531 ms
78,952 KB
testcase_09 AC 143 ms
78,348 KB
testcase_10 AC 262 ms
77,888 KB
testcase_11 AC 273 ms
77,892 KB
testcase_12 AC 173 ms
77,792 KB
testcase_13 AC 172 ms
78,548 KB
testcase_14 AC 1,687 ms
78,552 KB
testcase_15 AC 216 ms
78,564 KB
testcase_16 AC 238 ms
78,360 KB
testcase_17 AC 164 ms
77,668 KB
testcase_18 AC 181 ms
77,916 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 568 ms
79,260 KB
testcase_23 AC 444 ms
78,720 KB
testcase_24 AC 535 ms
78,976 KB
testcase_25 AC 383 ms
77,884 KB
testcase_26 AC 356 ms
78,152 KB
testcase_27 AC 355 ms
78,144 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 163 ms
78,140 KB
testcase_34 AC 270 ms
77,884 KB
testcase_35 AC 119 ms
71,880 KB
testcase_36 AC 91 ms
71,620 KB
testcase_37 AC 91 ms
71,976 KB
testcase_38 AC 92 ms
71,772 KB
testcase_39 AC 92 ms
71,952 KB
testcase_40 AC 91 ms
71,496 KB
testcase_41 AC 89 ms
71,944 KB
testcase_42 AC 91 ms
71,784 KB
testcase_43 AC 92 ms
71,648 KB
testcase_44 AC 128 ms
78,000 KB
testcase_45 AC 107 ms
77,600 KB
testcase_46 AC 145 ms
77,808 KB
testcase_47 AC 350 ms
77,968 KB
testcase_48 AC 114 ms
77,184 KB
testcase_49 WA -
testcase_50 AC 213 ms
78,708 KB
testcase_51 AC 283 ms
78,972 KB
testcase_52 AC 398 ms
78,316 KB
testcase_53 AC 191 ms
79,528 KB
testcase_54 AC 107 ms
77,588 KB
testcase_55 AC 217 ms
78,920 KB
testcase_56 AC 243 ms
78,472 KB
testcase_57 AC 524 ms
78,664 KB
testcase_58 AC 140 ms
78,140 KB
testcase_59 AC 383 ms
77,876 KB
testcase_60 AC 130 ms
77,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd

def ju(m):
    ret = 0
    for s in range(n):
        goal = s+m-1
        if goal >= n:break
        ok = 1
        for i in range(s, goal+1):
            if i == s:
                ok &= l <= a[s] * a[i+1] <= r
                ok &= l <= a[s] * a[goal] <= r
            elif i == goal:
                ok &= l <= a[s] * a[i] <= r
                ok &= l <= a[i-1] * a[i] <= r
            else:
                ok &= l <= a[s] * a[i] <= r
                ok &= l <= a[i] * a[goal] <= r
        ret |= ok
    return ret
    

n,l,r = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
le = 2
ri = n+1
for _ in range(13):
    m = (le+ri)//2
    if ju(m):
        le = m
    else:
        ri = m

if ju(le):
    print(le)
else:
    print(le-1)
        

0