結果

問題 No.2500 Products in a Range
ユーザー hato336hato336
提出日時 2023-10-13 21:43:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,267 bytes
コンパイル時間 503 ms
コンパイル使用メモリ 87,300 KB
実行使用メモリ 88,084 KB
最終ジャッジ日時 2023-10-13 21:43:33
合計ジャッジ時間 18,726 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 230 ms
85,448 KB
testcase_01 AC 228 ms
85,208 KB
testcase_02 AC 266 ms
86,368 KB
testcase_03 AC 229 ms
85,236 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 247 ms
84,964 KB
testcase_07 AC 254 ms
86,536 KB
testcase_08 AC 249 ms
86,540 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 245 ms
85,572 KB
testcase_14 AC 284 ms
87,312 KB
testcase_15 AC 265 ms
86,384 KB
testcase_16 AC 249 ms
86,576 KB
testcase_17 AC 250 ms
86,804 KB
testcase_18 AC 243 ms
86,716 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 273 ms
86,572 KB
testcase_25 AC 318 ms
87,100 KB
testcase_26 WA -
testcase_27 AC 317 ms
87,252 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 271 ms
87,344 KB
testcase_34 AC 295 ms
87,244 KB
testcase_35 AC 241 ms
85,120 KB
testcase_36 AC 239 ms
85,176 KB
testcase_37 AC 255 ms
84,776 KB
testcase_38 AC 242 ms
85,356 KB
testcase_39 AC 236 ms
85,132 KB
testcase_40 AC 233 ms
85,432 KB
testcase_41 AC 233 ms
85,020 KB
testcase_42 AC 242 ms
85,244 KB
testcase_43 AC 234 ms
85,228 KB
testcase_44 WA -
testcase_45 AC 236 ms
85,252 KB
testcase_46 AC 262 ms
86,216 KB
testcase_47 AC 322 ms
87,488 KB
testcase_48 AC 250 ms
85,104 KB
testcase_49 WA -
testcase_50 AC 263 ms
86,460 KB
testcase_51 AC 249 ms
86,840 KB
testcase_52 AC 249 ms
86,356 KB
testcase_53 AC 242 ms
86,400 KB
testcase_54 AC 235 ms
85,144 KB
testcase_55 RE -
testcase_56 RE -
testcase_57 AC 246 ms
86,320 KB
testcase_58 AC 245 ms
86,604 KB
testcase_59 AC 263 ms
86,648 KB
testcase_60 AC 239 ms
85,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
#n = int(input())
#
#alist = []
#s = input()
n,l,r = map(int,input().split())
#for i in range(n):
#    alist.append(list(map(int,input().split())))
alist = list(map(int,input().split()))
alist.sort()
ans = 1
temp = 1
for i in range(n-1):
    if l <= alist[i] * alist[i+1] <= r and alist[i] * alist[i+1] > 0:
        temp += 1
    else:
        ans = max(ans,temp)
        temp = 1
ans = max(ans,temp)
#print(alist)
m,p = [],[]
z = 0
for i in alist:
    if i<0:
        m.append(i)
    elif i>0:
        p.append(i)
    else:
        z += 1
m.sort()
p.sort()
for j in range(len(m)):
    i = m[j]
    check = 0
    for k in range(j,len(m)-1):
        if not (l <= m[k] * m[k+1] <= r):
            check = 1
            break
    if check:
        continue
    idx = 0
    while idx != len(p) - 1 and l <= i * p[idx] <= r:
        idx += 1
    if not (l <= i * p[idx] <= r):
        idx -= 1
    check = 0
    for k in range(idx):
        if not(l <= p[k] * p[k+1] <= r):
            check = 1
            break
    if check:continue
    ans = max(ans,len(m)-j+idx+1+ (z if l <= 0 <= r else 0))
    #print(m,p,j,idx,len(m)-j+idx+1)

print(ans)
0