結果
問題 | No.2500 Products in a Range |
ユーザー | aaaaaaaaaa2230 |
提出日時 | 2023-10-13 22:13:04 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,663 bytes |
コンパイル時間 | 316 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 76,800 KB |
最終ジャッジ日時 | 2024-09-15 17:56:19 |
合計ジャッジ時間 | 8,443 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
52,096 KB |
testcase_01 | AC | 40 ms
51,840 KB |
testcase_02 | AC | 70 ms
67,328 KB |
testcase_03 | AC | 50 ms
59,904 KB |
testcase_04 | AC | 57 ms
63,744 KB |
testcase_05 | AC | 65 ms
64,640 KB |
testcase_06 | AC | 49 ms
58,624 KB |
testcase_07 | AC | 87 ms
68,224 KB |
testcase_08 | AC | 124 ms
69,504 KB |
testcase_09 | AC | 66 ms
67,200 KB |
testcase_10 | AC | 214 ms
76,288 KB |
testcase_11 | AC | 247 ms
76,544 KB |
testcase_12 | AC | 141 ms
76,032 KB |
testcase_13 | AC | 70 ms
67,200 KB |
testcase_14 | AC | 305 ms
76,416 KB |
testcase_15 | AC | 76 ms
68,224 KB |
testcase_16 | AC | 78 ms
63,872 KB |
testcase_17 | AC | 116 ms
76,160 KB |
testcase_18 | AC | 68 ms
63,744 KB |
testcase_19 | AC | 63 ms
62,720 KB |
testcase_20 | AC | 91 ms
62,720 KB |
testcase_21 | AC | 50 ms
60,800 KB |
testcase_22 | AC | 274 ms
76,160 KB |
testcase_23 | AC | 273 ms
76,544 KB |
testcase_24 | AC | 278 ms
76,288 KB |
testcase_25 | AC | 334 ms
76,416 KB |
testcase_26 | AC | 336 ms
76,160 KB |
testcase_27 | AC | 332 ms
76,288 KB |
testcase_28 | AC | 83 ms
62,848 KB |
testcase_29 | AC | 54 ms
61,568 KB |
testcase_30 | AC | 53 ms
61,568 KB |
testcase_31 | WA | - |
testcase_32 | AC | 46 ms
58,112 KB |
testcase_33 | AC | 129 ms
76,160 KB |
testcase_34 | AC | 225 ms
76,800 KB |
testcase_35 | AC | 40 ms
52,096 KB |
testcase_36 | AC | 40 ms
52,352 KB |
testcase_37 | AC | 40 ms
51,584 KB |
testcase_38 | AC | 41 ms
52,224 KB |
testcase_39 | AC | 40 ms
51,968 KB |
testcase_40 | AC | 40 ms
52,224 KB |
testcase_41 | AC | 40 ms
51,840 KB |
testcase_42 | AC | 40 ms
52,224 KB |
testcase_43 | AC | 41 ms
52,224 KB |
testcase_44 | AC | 109 ms
76,160 KB |
testcase_45 | AC | 41 ms
52,352 KB |
testcase_46 | AC | 82 ms
62,336 KB |
testcase_47 | AC | 333 ms
75,904 KB |
testcase_48 | AC | 44 ms
57,088 KB |
testcase_49 | WA | - |
testcase_50 | AC | 82 ms
66,048 KB |
testcase_51 | AC | 87 ms
67,968 KB |
testcase_52 | AC | 114 ms
66,176 KB |
testcase_53 | AC | 68 ms
66,048 KB |
testcase_54 | AC | 46 ms
57,984 KB |
testcase_55 | AC | 82 ms
63,488 KB |
testcase_56 | AC | 107 ms
64,000 KB |
testcase_57 | AC | 143 ms
65,024 KB |
testcase_58 | AC | 64 ms
64,640 KB |
testcase_59 | AC | 119 ms
65,920 KB |
testcase_60 | AC | 57 ms
62,336 KB |
ソースコード
n,l,r = map(int,input().split()) A = list(map(int,input().split())) minus = [] plus = [] zero = [] for a in A: if a < 0: minus.append(a) elif a > 0: plus.append(a) else: zero.append(a) minus.sort() plus.sort() ans = 1 def solve1(plus,minus): ans = 1 minus += zero minus = minus[::-1] plus = zero + plus for i in range(len(minus)-1): for j in range(i+1,len(minus)): l1,l2 = minus[i],minus[i+1] r1,r2 = minus[j],minus[j-1] if l1*l2 >= l and r1*r2 <= r: ans = max(ans,j-i+1) for i in range(len(plus)-1): for j in range(i+1,len(plus)): l1,l2 = plus[i],plus[i+1] r1,r2 = plus[j],plus[j-1] if l1*l2 >= l and r1*r2 <= r: ans = max(ans,j-i+1) return ans def solve2(plus,minus): plus = zero + plus minus = minus[::-1] ans = 1 for i in range(len(plus)): for j in range(len(minus)): l1 = plus[i] if i: l2 = plus[i-1] else: l2 = 0 r1 = minus[j] if j: r2 = minus[j-1] else: r2 = 0 if l1*l2 <= r and r1*r2 <= r and l1*r1 >= l: ans = max(ans,j+i+2) return ans def solve3(plus,minus): ans = 1 for p in plus: for m in minus: if l <= p*m <= r: ans = 2 return ans if l >= 0: ans = solve1(plus[:],minus[:]) elif r < 0: ans = solve3(plus[:],minus[:]) else: ans = max(solve1(plus[:],minus[:]),solve2(plus[:],minus[:])) print(ans)