結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
71,704 KB
testcase_01 AC 93 ms
71,564 KB
testcase_02 AC 135 ms
78,184 KB
testcase_03 AC 156 ms
77,632 KB
testcase_04 AC 145 ms
78,416 KB
testcase_05 AC 128 ms
77,724 KB
testcase_06 AC 111 ms
77,264 KB
testcase_07 AC 292 ms
78,216 KB
testcase_08 AC 1,694 ms
79,008 KB
testcase_09 AC 143 ms
78,504 KB
testcase_10 AC 229 ms
77,664 KB
testcase_11 AC 268 ms
77,864 KB
testcase_12 AC 170 ms
77,984 KB
testcase_13 AC 168 ms
78,296 KB
testcase_14 AC 1,843 ms
78,640 KB
testcase_15 AC 196 ms
78,324 KB
testcase_16 AC 236 ms
78,292 KB
testcase_17 AC 191 ms
77,628 KB
testcase_18 AC 189 ms
77,920 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 581 ms
79,108 KB
testcase_23 AC 420 ms
78,696 KB
testcase_24 AC 554 ms
79,104 KB
testcase_25 AC 351 ms
77,816 KB
testcase_26 AC 377 ms
78,100 KB
testcase_27 AC 354 ms
78,140 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 158 ms
78,164 KB
testcase_34 AC 236 ms
77,864 KB
testcase_35 AC 90 ms
71,596 KB
testcase_36 AC 89 ms
71,600 KB
testcase_37 AC 90 ms
71,544 KB
testcase_38 AC 94 ms
71,512 KB
testcase_39 AC 89 ms
71,496 KB
testcase_40 AC 97 ms
71,848 KB
testcase_41 AC 88 ms
71,548 KB
testcase_42 AC 89 ms
71,496 KB
testcase_43 AC 92 ms
71,468 KB
testcase_44 AC 125 ms
77,952 KB
testcase_45 AC 107 ms
77,536 KB
testcase_46 AC 146 ms
77,760 KB
testcase_47 AC 335 ms
77,664 KB
testcase_48 AC 120 ms
77,396 KB
testcase_49 WA -
testcase_50 AC 208 ms
78,692 KB
testcase_51 AC 284 ms
78,976 KB
testcase_52 AC 391 ms
78,264 KB
testcase_53 AC 204 ms
79,428 KB
testcase_54 AC 111 ms
77,404 KB
testcase_55 AC 241 ms
78,748 KB
testcase_56 AC 241 ms
79,032 KB
testcase_57 AC 544 ms
78,412 KB
testcase_58 AC 137 ms
78,016 KB
testcase_59 AC 372 ms
78,164 KB
testcase_60 AC 123 ms
77,600 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(15):
    m = (le+ri)//2
    if ju(m):
        le = m
    else:
        ri = m

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

0