結果
問題 | No.2500 Products in a Range |
ユーザー | flygon |
提出日時 | 2023-10-13 22:19:37 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,708 ms / 2,000 ms |
コード長 | 1,108 bytes |
コンパイル時間 | 420 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 77,568 KB |
最終ジャッジ日時 | 2024-09-15 18:03:44 |
合計ジャッジ時間 | 15,962 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 48 ms
54,144 KB |
testcase_01 | AC | 48 ms
54,144 KB |
testcase_02 | AC | 107 ms
76,416 KB |
testcase_03 | AC | 94 ms
73,856 KB |
testcase_04 | AC | 117 ms
76,544 KB |
testcase_05 | AC | 95 ms
74,752 KB |
testcase_06 | AC | 73 ms
67,712 KB |
testcase_07 | AC | 253 ms
76,800 KB |
testcase_08 | AC | 1,547 ms
76,800 KB |
testcase_09 | AC | 112 ms
76,416 KB |
testcase_10 | AC | 205 ms
76,288 KB |
testcase_11 | AC | 243 ms
76,288 KB |
testcase_12 | AC | 141 ms
76,160 KB |
testcase_13 | AC | 140 ms
77,184 KB |
testcase_14 | AC | 1,708 ms
76,672 KB |
testcase_15 | AC | 163 ms
76,928 KB |
testcase_16 | AC | 261 ms
76,672 KB |
testcase_17 | AC | 165 ms
76,160 KB |
testcase_18 | AC | 180 ms
76,544 KB |
testcase_19 | AC | 394 ms
76,800 KB |
testcase_20 | AC | 417 ms
76,416 KB |
testcase_21 | AC | 112 ms
76,288 KB |
testcase_22 | AC | 538 ms
76,544 KB |
testcase_23 | AC | 385 ms
76,672 KB |
testcase_24 | AC | 507 ms
76,800 KB |
testcase_25 | AC | 323 ms
76,032 KB |
testcase_26 | AC | 327 ms
76,416 KB |
testcase_27 | AC | 318 ms
76,160 KB |
testcase_28 | AC | 354 ms
76,672 KB |
testcase_29 | AC | 124 ms
76,672 KB |
testcase_30 | AC | 120 ms
76,928 KB |
testcase_31 | AC | 98 ms
76,928 KB |
testcase_32 | AC | 99 ms
76,672 KB |
testcase_33 | AC | 127 ms
76,160 KB |
testcase_34 | AC | 213 ms
76,288 KB |
testcase_35 | AC | 48 ms
54,144 KB |
testcase_36 | AC | 48 ms
54,528 KB |
testcase_37 | AC | 48 ms
53,760 KB |
testcase_38 | AC | 48 ms
54,144 KB |
testcase_39 | AC | 49 ms
54,272 KB |
testcase_40 | AC | 47 ms
54,016 KB |
testcase_41 | AC | 47 ms
54,144 KB |
testcase_42 | AC | 47 ms
54,528 KB |
testcase_43 | AC | 47 ms
54,272 KB |
testcase_44 | AC | 95 ms
76,416 KB |
testcase_45 | AC | 69 ms
66,944 KB |
testcase_46 | AC | 124 ms
77,056 KB |
testcase_47 | AC | 310 ms
75,776 KB |
testcase_48 | AC | 77 ms
69,248 KB |
testcase_49 | AC | 81 ms
70,016 KB |
testcase_50 | AC | 179 ms
76,288 KB |
testcase_51 | AC | 249 ms
77,056 KB |
testcase_52 | AC | 363 ms
76,416 KB |
testcase_53 | AC | 161 ms
77,568 KB |
testcase_54 | AC | 66 ms
64,768 KB |
testcase_55 | AC | 184 ms
76,928 KB |
testcase_56 | AC | 210 ms
77,440 KB |
testcase_57 | AC | 497 ms
76,416 KB |
testcase_58 | AC | 119 ms
76,672 KB |
testcase_59 | AC | 414 ms
76,416 KB |
testcase_60 | AC | 104 ms
75,904 KB |
ソースコード
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(1)