結果

問題 No.1460 Max of Min
ユーザー shiomusubi496shiomusubi496
提出日時 2021-03-29 14:08:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,226 ms / 2,000 ms
コード長 1,085 bytes
コンパイル時間 332 ms
コンパイル使用メモリ 87,196 KB
実行使用メモリ 77,940 KB
最終ジャッジ日時 2023-08-20 02:32:26
合計ジャッジ時間 47,887 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,068 KB
testcase_01 AC 73 ms
71,364 KB
testcase_02 AC 75 ms
75,408 KB
testcase_03 AC 110 ms
76,472 KB
testcase_04 AC 1,226 ms
77,124 KB
testcase_05 AC 72 ms
71,348 KB
testcase_06 AC 180 ms
77,612 KB
testcase_07 AC 1,105 ms
77,548 KB
testcase_08 AC 73 ms
71,304 KB
testcase_09 AC 76 ms
71,496 KB
testcase_10 AC 982 ms
77,500 KB
testcase_11 AC 563 ms
77,748 KB
testcase_12 AC 188 ms
77,528 KB
testcase_13 AC 648 ms
77,536 KB
testcase_14 AC 241 ms
77,544 KB
testcase_15 AC 173 ms
77,212 KB
testcase_16 AC 450 ms
77,744 KB
testcase_17 AC 514 ms
77,576 KB
testcase_18 AC 106 ms
76,880 KB
testcase_19 AC 411 ms
77,768 KB
testcase_20 AC 121 ms
77,196 KB
testcase_21 AC 161 ms
77,072 KB
testcase_22 AC 346 ms
77,556 KB
testcase_23 AC 117 ms
76,932 KB
testcase_24 AC 559 ms
77,792 KB
testcase_25 AC 107 ms
77,144 KB
testcase_26 AC 843 ms
77,640 KB
testcase_27 AC 255 ms
77,284 KB
testcase_28 AC 160 ms
77,292 KB
testcase_29 AC 699 ms
77,496 KB
testcase_30 AC 435 ms
77,744 KB
testcase_31 AC 283 ms
77,640 KB
testcase_32 AC 733 ms
77,512 KB
testcase_33 AC 219 ms
77,336 KB
testcase_34 AC 278 ms
77,868 KB
testcase_35 AC 190 ms
77,320 KB
testcase_36 AC 171 ms
77,292 KB
testcase_37 AC 419 ms
77,660 KB
testcase_38 AC 408 ms
77,604 KB
testcase_39 AC 301 ms
77,544 KB
testcase_40 AC 226 ms
77,160 KB
testcase_41 AC 182 ms
77,396 KB
testcase_42 AC 201 ms
77,584 KB
testcase_43 AC 346 ms
77,360 KB
testcase_44 AC 501 ms
77,476 KB
testcase_45 AC 121 ms
76,960 KB
testcase_46 AC 283 ms
77,580 KB
testcase_47 AC 338 ms
77,748 KB
testcase_48 AC 597 ms
77,576 KB
testcase_49 AC 326 ms
77,516 KB
testcase_50 AC 130 ms
77,060 KB
testcase_51 AC 516 ms
77,348 KB
testcase_52 AC 171 ms
77,104 KB
testcase_53 AC 339 ms
77,748 KB
testcase_54 AC 477 ms
77,800 KB
testcase_55 AC 611 ms
77,672 KB
testcase_56 AC 563 ms
77,940 KB
testcase_57 AC 819 ms
77,524 KB
testcase_58 AC 896 ms
77,648 KB
testcase_59 AC 637 ms
77,704 KB
testcase_60 AC 590 ms
77,652 KB
testcase_61 AC 617 ms
77,848 KB
testcase_62 AC 459 ms
77,476 KB
testcase_63 AC 847 ms
77,408 KB
testcase_64 AC 488 ms
77,388 KB
testcase_65 AC 839 ms
77,584 KB
testcase_66 AC 512 ms
77,476 KB
testcase_67 AC 479 ms
77,424 KB
testcase_68 AC 491 ms
77,564 KB
testcase_69 AC 943 ms
77,600 KB
testcase_70 AC 690 ms
77,524 KB
testcase_71 AC 644 ms
77,700 KB
testcase_72 AC 450 ms
77,388 KB
testcase_73 AC 672 ms
77,648 KB
testcase_74 AC 691 ms
77,652 KB
testcase_75 AC 523 ms
77,524 KB
testcase_76 AC 531 ms
77,560 KB
testcase_77 AC 511 ms
77,700 KB
testcase_78 AC 457 ms
77,656 KB
testcase_79 AC 435 ms
77,368 KB
testcase_80 AC 466 ms
77,516 KB
testcase_81 AC 453 ms
77,376 KB
testcase_82 AC 465 ms
77,676 KB
testcase_83 AC 492 ms
77,516 KB
testcase_84 AC 855 ms
77,432 KB
testcase_85 AC 828 ms
77,368 KB
testcase_86 AC 824 ms
77,572 KB
testcase_87 AC 864 ms
77,752 KB
testcase_88 AC 847 ms
77,668 KB
testcase_89 AC 853 ms
77,588 KB
testcase_90 AC 835 ms
77,416 KB
testcase_91 AC 873 ms
77,324 KB
testcase_92 AC 873 ms
77,764 KB
testcase_93 AC 824 ms
77,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

INF=10**18+1;
#bool chmin(ll&a,ll b){return a>b?a=b,true:false;}
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