結果

問題 No.2500 Products in a Range
ユーザー mkawa2mkawa2
提出日時 2023-10-13 22:39:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 930 ms / 2,000 ms
コード長 1,184 bytes
コンパイル時間 1,277 ms
コンパイル使用メモリ 87,168 KB
実行使用メモリ 274,028 KB
最終ジャッジ日時 2023-10-13 22:39:46
合計ジャッジ時間 19,655 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,296 KB
testcase_01 AC 74 ms
71,244 KB
testcase_02 AC 104 ms
76,432 KB
testcase_03 AC 85 ms
76,132 KB
testcase_04 AC 94 ms
76,504 KB
testcase_05 AC 98 ms
76,492 KB
testcase_06 AC 87 ms
76,240 KB
testcase_07 AC 212 ms
106,340 KB
testcase_08 AC 527 ms
228,244 KB
testcase_09 AC 96 ms
76,216 KB
testcase_10 AC 494 ms
178,048 KB
testcase_11 AC 634 ms
205,048 KB
testcase_12 AC 257 ms
113,324 KB
testcase_13 AC 101 ms
76,496 KB
testcase_14 AC 604 ms
228,016 KB
testcase_15 AC 120 ms
84,192 KB
testcase_16 AC 324 ms
202,808 KB
testcase_17 AC 195 ms
132,892 KB
testcase_18 AC 206 ms
136,128 KB
testcase_19 AC 393 ms
227,752 KB
testcase_20 AC 425 ms
250,600 KB
testcase_21 AC 109 ms
86,496 KB
testcase_22 AC 486 ms
273,800 KB
testcase_23 AC 523 ms
274,028 KB
testcase_24 AC 478 ms
273,604 KB
testcase_25 AC 908 ms
273,672 KB
testcase_26 AC 930 ms
273,792 KB
testcase_27 AC 927 ms
273,936 KB
testcase_28 AC 365 ms
225,528 KB
testcase_29 AC 128 ms
90,916 KB
testcase_30 AC 120 ms
90,468 KB
testcase_31 AC 86 ms
76,468 KB
testcase_32 AC 92 ms
76,392 KB
testcase_33 AC 238 ms
113,544 KB
testcase_34 AC 520 ms
182,088 KB
testcase_35 AC 73 ms
71,324 KB
testcase_36 AC 74 ms
71,352 KB
testcase_37 AC 73 ms
71,432 KB
testcase_38 AC 74 ms
71,328 KB
testcase_39 AC 74 ms
71,388 KB
testcase_40 AC 72 ms
71,480 KB
testcase_41 AC 73 ms
71,400 KB
testcase_42 AC 73 ms
71,328 KB
testcase_43 AC 72 ms
71,056 KB
testcase_44 AC 154 ms
90,632 KB
testcase_45 AC 85 ms
76,444 KB
testcase_46 AC 167 ms
113,320 KB
testcase_47 AC 909 ms
273,656 KB
testcase_48 AC 80 ms
75,964 KB
testcase_49 AC 78 ms
75,984 KB
testcase_50 AC 210 ms
136,208 KB
testcase_51 AC 239 ms
150,400 KB
testcase_52 AC 370 ms
228,136 KB
testcase_53 AC 124 ms
90,568 KB
testcase_54 AC 78 ms
75,928 KB
testcase_55 AC 206 ms
136,396 KB
testcase_56 AC 236 ms
150,600 KB
testcase_57 AC 415 ms
227,856 KB
testcase_58 AC 118 ms
90,376 KB
testcase_59 AC 404 ms
248,444 KB
testcase_60 AC 91 ms
76,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
# sys.set_int_max_str_digits(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
# inf = -1-(-1 << 31)
inf = -1-(-1 << 63)
# md = 10**9+7
md = 998244353

n, l, r = LI()
aa = LI()
aa.sort()

ans=1
dp = [[0]*n for _ in range(n)]
for i in range(n):
    dp[i][i]=1
    for j in range(i):
        if l <= aa[i]*aa[j] <= r: 
            dp[i][j] = dp[j][i] = 1
            ans=2

for i in range(n-1):
    for j in range(n-1):
        if dp[i+1][j+1]==0:continue
        dp[i+1][j+1]=min(dp[i][j],dp[i+1][j],dp[i][j+1])+1

ans=max(ans,max(dp[i][i] for i in range(n)))
print(ans)
0