提出 #75632989


ソースコード 拡げる

def main():
    n,k=map(int,input().split())
    k-=1
    l=[]
    a=[]
    for i in range(n):
        la=list(map(int,input().split()))
        l.append(la[0])
        a.append(la[1:])
    c=list(map(int,input().split()))
    lc_sig=[0]
    for i in range(n):
        lc_sig.append(lc_sig[-1]+l[i]*c[i])
    ok=0
    ng=n
    while abs(ok-ng)>1:
        mid=(ok+ng)//2
        if lc_sig[mid]<=k:
            ok=mid
        else:
            ng=mid
    di=k-lc_sig[ok]
    #print(di)
    #print(ok)
    print(a[ok][di%l[ok]])
    
main()

提出情報

提出日時
問題 C - Long Sequence
ユーザ st0123
言語 Python (PyPy 3.11-v7.3.20)
得点 300
コード長 567 Byte
結果 AC
実行時間 319 ms
メモリ 185764 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 23
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 53 ms 79584 KiB
00_sample_01.txt AC 53 ms 79476 KiB
00_sample_02.txt AC 52 ms 79584 KiB
01_random_00.txt AC 141 ms 121544 KiB
01_random_01.txt AC 214 ms 147064 KiB
01_random_02.txt AC 114 ms 113656 KiB
01_random_03.txt AC 193 ms 141460 KiB
01_random_04.txt AC 201 ms 142240 KiB
01_random_05.txt AC 172 ms 131424 KiB
01_random_06.txt AC 126 ms 118024 KiB
01_random_07.txt AC 308 ms 185188 KiB
01_random_08.txt AC 95 ms 109172 KiB
01_random_09.txt AC 256 ms 161636 KiB
01_random_10.txt AC 86 ms 136032 KiB
01_random_11.txt AC 86 ms 136292 KiB
01_random_12.txt AC 86 ms 136240 KiB
01_random_13.txt AC 317 ms 185764 KiB
01_random_14.txt AC 319 ms 185612 KiB
01_random_15.txt AC 315 ms 185632 KiB
01_random_16.txt AC 269 ms 168244 KiB
01_random_17.txt AC 221 ms 146636 KiB
01_random_18.txt AC 191 ms 137780 KiB
01_random_19.txt AC 93 ms 109720 KiB