2052021-02-06 17:06:54Molnár AttilaZenehallgatáspython3Runtime error 15/50289ms54532 KiB
from sys import stdin, stdout

def helye(x,N,T):
    e=0
    v=N-1
    k=0
    while True:
        k = (e+v)//2
        if x<T[k]:
            v=k-1
        elif T[k]<x:
            e=k+1
        if T[k]==x:
            return k
        if e>v:
            return e
    

def main():
    N,K = list(map(int,stdin.readline().split()))
    T = list(map(int,stdin.readline().split()))
    
    s=0
    kumulativ = []
    for szamhossz in T:
        s += szamhossz
        kumulativ.append(s)

    for p in map(int,stdin.readline().split()):
        stdout.write(str(helye(p%s, N, kumulativ)+1)+' ')
    stdout.write('\n')

main()
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/037ms13420 KiB
2Runtime error0/0104ms41228 KiB
3Accepted2/232ms14916 KiB
4Accepted2/232ms14972 KiB
5Accepted2/232ms14952 KiB
6Accepted3/337ms15104 KiB
7Accepted3/343ms15040 KiB
8Accepted3/335ms15044 KiB
9Runtime error0/2138ms42780 KiB
10Runtime error0/293ms44292 KiB
11Runtime error0/2116ms45708 KiB
12Runtime error0/298ms47288 KiB
13Runtime error0/2129ms48888 KiB
14Runtime error0/2107ms50404 KiB
15Runtime error0/279ms49812 KiB
16Runtime error0/283ms51152 KiB
17Time limit exceeded0/2289ms31140 KiB
18Runtime error0/292ms53284 KiB
19Runtime error0/296ms54112 KiB
20Runtime error0/276ms54448 KiB
21Runtime error0/297ms54532 KiB
22Runtime error0/396ms54448 KiB
23Runtime error0/376ms54532 KiB
24Runtime error0/374ms54452 KiB