123922024-12-16 14:42:21szabelrZenehallgatáscpp17Time limit exceeded 15/50300ms840 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()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    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; i++){
        cin>>y;
        if(y>a[n])
            y=y%a[n];
        int mo=keres(y,n);
        cout<<mo<<" ";
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/01ms512 KiB
2Time limit exceeded0/0284ms824 KiB
3Accepted2/22ms500 KiB
4Accepted2/22ms320 KiB
5Accepted2/21ms412 KiB
6Accepted3/31ms320 KiB
7Accepted3/32ms552 KiB
8Accepted3/31ms324 KiB
9Time limit exceeded0/2300ms828 KiB
10Time limit exceeded0/2298ms816 KiB
11Time limit exceeded0/2300ms816 KiB
12Time limit exceeded0/2287ms824 KiB
13Time limit exceeded0/2287ms824 KiB
14Time limit exceeded0/2287ms824 KiB
15Time limit exceeded0/2300ms824 KiB
16Time limit exceeded0/2289ms824 KiB
17Time limit exceeded0/2280ms840 KiB
18Time limit exceeded0/2282ms824 KiB
19Time limit exceeded0/2298ms828 KiB
20Time limit exceeded0/2294ms824 KiB
21Time limit exceeded0/2282ms828 KiB
22Time limit exceeded0/3282ms824 KiB
23Time limit exceeded0/3300ms648 KiB
24Time limit exceeded0/3282ms824 KiB