結果

問題 No.1460 Max of Min
ユーザー shiomusubi496shiomusubi496
提出日時 2021-03-29 14:09:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,231 ms / 2,000 ms
コード長 1,033 bytes
コンパイル時間 444 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 77,892 KB
最終ジャッジ日時 2023-08-20 02:33:15
合計ジャッジ時間 48,402 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,224 KB
testcase_01 AC 76 ms
71,412 KB
testcase_02 AC 77 ms
75,164 KB
testcase_03 AC 107 ms
76,520 KB
testcase_04 AC 1,231 ms
77,412 KB
testcase_05 AC 78 ms
71,452 KB
testcase_06 AC 188 ms
77,564 KB
testcase_07 AC 1,118 ms
77,716 KB
testcase_08 AC 71 ms
71,128 KB
testcase_09 AC 71 ms
71,408 KB
testcase_10 AC 979 ms
77,324 KB
testcase_11 AC 560 ms
77,752 KB
testcase_12 AC 184 ms
77,348 KB
testcase_13 AC 648 ms
77,716 KB
testcase_14 AC 238 ms
77,416 KB
testcase_15 AC 173 ms
77,504 KB
testcase_16 AC 445 ms
77,748 KB
testcase_17 AC 511 ms
77,692 KB
testcase_18 AC 102 ms
77,112 KB
testcase_19 AC 409 ms
77,552 KB
testcase_20 AC 120 ms
77,352 KB
testcase_21 AC 160 ms
77,172 KB
testcase_22 AC 344 ms
77,744 KB
testcase_23 AC 117 ms
77,224 KB
testcase_24 AC 560 ms
77,352 KB
testcase_25 AC 104 ms
77,252 KB
testcase_26 AC 839 ms
77,564 KB
testcase_27 AC 253 ms
77,012 KB
testcase_28 AC 155 ms
77,096 KB
testcase_29 AC 692 ms
77,480 KB
testcase_30 AC 434 ms
77,312 KB
testcase_31 AC 277 ms
77,768 KB
testcase_32 AC 729 ms
77,520 KB
testcase_33 AC 215 ms
77,412 KB
testcase_34 AC 275 ms
77,676 KB
testcase_35 AC 187 ms
77,656 KB
testcase_36 AC 167 ms
77,160 KB
testcase_37 AC 416 ms
77,688 KB
testcase_38 AC 406 ms
77,440 KB
testcase_39 AC 301 ms
77,208 KB
testcase_40 AC 222 ms
77,356 KB
testcase_41 AC 179 ms
77,516 KB
testcase_42 AC 200 ms
77,164 KB
testcase_43 AC 339 ms
77,484 KB
testcase_44 AC 493 ms
77,560 KB
testcase_45 AC 119 ms
77,064 KB
testcase_46 AC 279 ms
77,232 KB
testcase_47 AC 330 ms
77,752 KB
testcase_48 AC 592 ms
77,484 KB
testcase_49 AC 324 ms
77,740 KB
testcase_50 AC 126 ms
77,460 KB
testcase_51 AC 512 ms
77,372 KB
testcase_52 AC 169 ms
77,240 KB
testcase_53 AC 331 ms
77,604 KB
testcase_54 AC 475 ms
77,480 KB
testcase_55 AC 605 ms
77,424 KB
testcase_56 AC 561 ms
77,620 KB
testcase_57 AC 808 ms
77,664 KB
testcase_58 AC 897 ms
77,504 KB
testcase_59 AC 623 ms
77,400 KB
testcase_60 AC 587 ms
77,508 KB
testcase_61 AC 610 ms
77,852 KB
testcase_62 AC 454 ms
77,340 KB
testcase_63 AC 845 ms
77,520 KB
testcase_64 AC 482 ms
77,800 KB
testcase_65 AC 832 ms
77,832 KB
testcase_66 AC 505 ms
77,592 KB
testcase_67 AC 475 ms
77,364 KB
testcase_68 AC 480 ms
77,684 KB
testcase_69 AC 938 ms
77,504 KB
testcase_70 AC 683 ms
77,892 KB
testcase_71 AC 631 ms
77,508 KB
testcase_72 AC 448 ms
77,336 KB
testcase_73 AC 667 ms
77,696 KB
testcase_74 AC 687 ms
77,480 KB
testcase_75 AC 514 ms
77,608 KB
testcase_76 AC 527 ms
77,660 KB
testcase_77 AC 509 ms
77,712 KB
testcase_78 AC 451 ms
77,472 KB
testcase_79 AC 429 ms
77,312 KB
testcase_80 AC 464 ms
77,656 KB
testcase_81 AC 452 ms
77,604 KB
testcase_82 AC 458 ms
77,396 KB
testcase_83 AC 484 ms
77,616 KB
testcase_84 AC 847 ms
77,524 KB
testcase_85 AC 823 ms
77,820 KB
testcase_86 AC 823 ms
77,684 KB
testcase_87 AC 868 ms
77,820 KB
testcase_88 AC 842 ms
77,836 KB
testcase_89 AC 845 ms
77,860 KB
testcase_90 AC 832 ms
77,524 KB
testcase_91 AC 875 ms
77,564 KB
testcase_92 AC 880 ms
77,528 KB
testcase_93 AC 822 ms
77,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

INF=10**18+1
def check(X):
    b=[]
    for i in range(K-1,-1,-1):
        if B[i]>=X:
            b+=[K-i]
    if len(b)==0:
        return N<K and A[N]>=X
    M=b[0]
    dist=[INF for i in range(K+M)]
    seen=[False for i in range(K+M)]
    for i in range(K):
        if A[i]>=X:
            dist[i]=i
    for i in range(K+M):
        idx=-1
        mn=INF+1
        for j in range(K+M):
            if mn>dist[j] and (not seen[j]):
                idx=j
                mn=dist[j]
        seen[idx]=True
        for j in b:
            if idx<K:
                if idx+j>=K:
                    dist[K+(idx+j)%M]=min(dist[K+(idx+j)%M],dist[idx]+j)
            else:
                dist[K+(idx-K+j)%M]=min(dist[K+(idx-K+j)%M],dist[idx]+j)
    if N<K:
        return dist[N]<=N
    else:
        return dist[K+N%M]<=N
K,N=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
ok=-INF
ng=INF
while ng-ok>1:
    mid=(ok+ng)//2
    if check(mid):
        ok=mid
    else:
        ng=mid
print(ok)
0