結果

問題 No.2500 Products in a Range
ユーザー flygonflygon
提出日時 2023-10-13 22:12:11
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,111 bytes
コンパイル時間 453 ms
コンパイル使用メモリ 87,132 KB
実行使用メモリ 79,252 KB
最終ジャッジ日時 2023-10-13 22:12:31
合計ジャッジ時間 19,668 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
71,712 KB
testcase_01 AC 94 ms
71,392 KB
testcase_02 AC 138 ms
78,172 KB
testcase_03 AC 130 ms
77,616 KB
testcase_04 AC 151 ms
78,468 KB
testcase_05 AC 136 ms
77,940 KB
testcase_06 AC 118 ms
77,300 KB
testcase_07 AC 288 ms
78,124 KB
testcase_08 AC 1,619 ms
78,836 KB
testcase_09 AC 150 ms
78,368 KB
testcase_10 AC 242 ms
77,756 KB
testcase_11 AC 276 ms
77,816 KB
testcase_12 AC 177 ms
78,100 KB
testcase_13 AC 174 ms
78,436 KB
testcase_14 AC 1,770 ms
78,340 KB
testcase_15 AC 199 ms
78,548 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 428 ms
78,236 KB
testcase_20 AC 458 ms
78,176 KB
testcase_21 AC 149 ms
78,576 KB
testcase_22 AC 582 ms
78,968 KB
testcase_23 AC 422 ms
78,744 KB
testcase_24 AC 544 ms
78,808 KB
testcase_25 AC 360 ms
77,708 KB
testcase_26 AC 364 ms
77,824 KB
testcase_27 AC 357 ms
77,992 KB
testcase_28 AC 397 ms
78,400 KB
testcase_29 AC 158 ms
78,336 KB
testcase_30 AC 153 ms
78,396 KB
testcase_31 AC 135 ms
78,100 KB
testcase_32 AC 135 ms
78,408 KB
testcase_33 AC 165 ms
77,916 KB
testcase_34 AC 250 ms
77,996 KB
testcase_35 AC 95 ms
71,720 KB
testcase_36 AC 94 ms
71,584 KB
testcase_37 AC 94 ms
71,388 KB
testcase_38 AC 95 ms
71,472 KB
testcase_39 AC 98 ms
71,608 KB
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 95 ms
71,872 KB
testcase_43 WA -
testcase_44 AC 131 ms
77,608 KB
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 352 ms
77,984 KB
testcase_48 WA -
testcase_49 AC 120 ms
77,436 KB
testcase_50 AC 215 ms
78,436 KB
testcase_51 AC 289 ms
78,936 KB
testcase_52 AC 401 ms
78,472 KB
testcase_53 AC 197 ms
79,252 KB
testcase_54 AC 111 ms
77,444 KB
testcase_55 AC 226 ms
78,784 KB
testcase_56 AC 248 ms
78,536 KB
testcase_57 AC 538 ms
78,648 KB
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
権限があれば一括ダウンロードができます

ソースコード

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[i] * a[i+1] <= r
                ok &= l <= a[i] * 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 le != 2:
    print(le)
else:
    ok = 0
    for i in range(n):
        for j in range(i+1, n):
            ok |= l <= a[i]*a[j] <= r
    print(2) if ok else print('No')


0