123912024-12-16 14:41:10szabelrZenehallgatá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()
{
    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/01ms320 KiB
2Time limit exceeded0/0284ms840 KiB
3Accepted2/23ms508 KiB
4Accepted2/23ms320 KiB
5Accepted2/23ms320 KiB
6Accepted3/33ms408 KiB
7Accepted3/33ms320 KiB
8Accepted3/33ms320 KiB
9Time limit exceeded0/2300ms808 KiB
10Time limit exceeded0/2300ms700 KiB
11Time limit exceeded0/2298ms800 KiB
12Time limit exceeded0/2286ms756 KiB
13Time limit exceeded0/2284ms828 KiB
14Time limit exceeded0/2284ms824 KiB
15Time limit exceeded0/2300ms644 KiB
16Time limit exceeded0/2277ms824 KiB
17Time limit exceeded0/2300ms824 KiB
18Time limit exceeded0/2300ms716 KiB
19Time limit exceeded0/2280ms824 KiB
20Time limit exceeded0/2273ms828 KiB
21Time limit exceeded0/2300ms768 KiB
22Time limit exceeded0/3300ms824 KiB
23Time limit exceeded0/3275ms824 KiB
24Time limit exceeded0/3277ms824 KiB