123902024-12-16 14:39:31szabelrZenehallgatáscpp17Time limit exceeded 0/50300ms6752 KiB
#include <iostream>

using namespace std;
int a[100001]{0};
int keres(int y, int n)
{
    if(y<=a[1])
        return 1;
    for(int i=1; i<=n; i++){
        if(a[i]>=y)
            return i;
    }
}
int main()
{
    int n,k,x,y;
    cin>>n>>k;
    for(int i=1; i<=n; i++){
        cin>>x;
        a[i]=a[i-1]+x;
    }
    for(int i=1; i<=k; k++){
        cin>>y;
        if(y>a[n])
            y=y%a[n];
        int mo=keres(y,n);
        cout<<mo<<" ";
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Time limit exceeded0/0286ms5176 KiB
2Time limit exceeded0/0286ms824 KiB
3Time limit exceeded0/2286ms2468 KiB
4Time limit exceeded0/2286ms2364 KiB
5Time limit exceeded0/2282ms4404 KiB
6Time limit exceeded0/3282ms6752 KiB
7Time limit exceeded0/3284ms3904 KiB
8Time limit exceeded0/3284ms2872 KiB
9Time limit exceeded0/2277ms824 KiB
10Time limit exceeded0/2277ms824 KiB
11Time limit exceeded0/2280ms824 KiB
12Time limit exceeded0/2280ms824 KiB
13Time limit exceeded0/2284ms856 KiB
14Time limit exceeded0/2284ms852 KiB
15Time limit exceeded0/2287ms824 KiB
16Time limit exceeded0/2287ms824 KiB
17Time limit exceeded0/2287ms1052 KiB
18Time limit exceeded0/2287ms648 KiB
19Time limit exceeded0/2289ms812 KiB
20Time limit exceeded0/2298ms792 KiB
21Time limit exceeded0/2282ms856 KiB
22Time limit exceeded0/3286ms748 KiB
23Time limit exceeded0/3300ms664 KiB
24Time limit exceeded0/3298ms800 KiB