結果

問題 No.2056 非力なレッド
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2022-08-22 01:36:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 471 ms / 2,000 ms
コード長 1,123 bytes
コンパイル時間 371 ms
コンパイル使用メモリ 82,448 KB
実行使用メモリ 157,380 KB
最終ジャッジ日時 2024-04-18 13:18:39
合計ジャッジ時間 10,783 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
54,144 KB
testcase_01 AC 46 ms
53,888 KB
testcase_02 AC 47 ms
54,528 KB
testcase_03 AC 45 ms
54,400 KB
testcase_04 AC 46 ms
54,528 KB
testcase_05 AC 42 ms
54,144 KB
testcase_06 AC 45 ms
54,016 KB
testcase_07 AC 50 ms
54,400 KB
testcase_08 AC 46 ms
54,784 KB
testcase_09 AC 46 ms
54,144 KB
testcase_10 AC 46 ms
54,144 KB
testcase_11 AC 45 ms
54,144 KB
testcase_12 AC 46 ms
54,272 KB
testcase_13 AC 309 ms
122,632 KB
testcase_14 AC 310 ms
121,748 KB
testcase_15 AC 303 ms
121,824 KB
testcase_16 AC 94 ms
80,988 KB
testcase_17 AC 234 ms
108,004 KB
testcase_18 AC 74 ms
70,784 KB
testcase_19 AC 102 ms
82,104 KB
testcase_20 AC 351 ms
131,032 KB
testcase_21 AC 126 ms
88,420 KB
testcase_22 AC 313 ms
121,728 KB
testcase_23 AC 277 ms
114,580 KB
testcase_24 AC 174 ms
97,360 KB
testcase_25 AC 362 ms
132,408 KB
testcase_26 AC 385 ms
136,884 KB
testcase_27 AC 370 ms
133,888 KB
testcase_28 AC 442 ms
157,152 KB
testcase_29 AC 440 ms
157,288 KB
testcase_30 AC 471 ms
157,296 KB
testcase_31 AC 437 ms
157,116 KB
testcase_32 AC 442 ms
157,288 KB
testcase_33 AC 445 ms
156,992 KB
testcase_34 AC 446 ms
157,380 KB
testcase_35 AC 442 ms
157,224 KB
testcase_36 AC 439 ms
157,104 KB
testcase_37 AC 451 ms
157,376 KB
testcase_38 AC 47 ms
54,144 KB
testcase_39 AC 47 ms
54,272 KB
testcase_40 AC 46 ms
54,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


from random import randrange as rd
def make(N,X,M,A):
    n=rd(1,N+1)
    x=rd(1,X+1)
    m=rd(M+1)
    a=[rd(1,A+1) for i in range(n)]
    return n,x,m,a


def sol1(n,x,m,A):
    a=A[:]
    need=[0]*(n+1)
    for i in range(n):
        while a[i]>=x:
            need[i]+=1
            a[i]//=2
    for i in range(n-1,-1,-1):
        need[i]=max(need[i],need[i+1])
    if sum(need)<=m:return "Yes"
    return "No"

def sol2(n,x,m,A):
    a=[0]+A[:]
    dp=[[10**10]*33 for i in range(n+3)]
    dp[0][32]=0
    for i in range(1,n+1):
        sdp=[10**10]*35
        for j in range(32,-1,-1):
            sdp[j]=min(sdp[j+1],dp[i-1][j])

        for j in range(33):
            if x<=a[i]//(2**j):continue
            dp[i][j]=sdp[j]+j

    res=10**10
    for j in range(33):
        res=min(res,dp[n][j])
    if res<=m:return "Yes"
    return "No"

n,x,m=map(int,input().split())
a=list(map(int,input().split()))
print(sol2(n,x,m,a))
cnt=0
while 0:
    cnt+=1
    print(cnt)
    n,x,m,a=make(15,30,30,60)
    ans1=sol1(n,x,m,a)
    ans2=sol2(n,x,m,a)
    if ans1!=ans2:
        print("!")
        exit()
    print(ans1)

0