結果
| 問題 |
No.2500 Products in a Range
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-10-13 21:56:24 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 994 bytes |
| コンパイル時間 | 212 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 78,208 KB |
| 最終ジャッジ日時 | 2024-09-15 17:37:27 |
| 合計ジャッジ時間 | 15,396 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 52 WA * 9 |
ソースコード
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)