122922024-12-11 12:53:54ruffbrigiZenehallgatáscpp17Time limit exceeded 15/50300ms2028 KiB
#include <iostream>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,k;
    cin>>n;
    cin>>k;
    long long t[n],p[k];
    cin>>t[0];
    for(int i=1;i<=n-1;i++)
    {
        cin>>t[i];
        t[i]+=t[i-1];
    }
    for(int j=0;j<=k-1;j++)
    {
        cin>>p[j];
        p[j]=p[j]%t[n-1];
    }
    for(int j=0;j<=k-1;j++)
    {
        if(p[j]==0) cout<<n<<" ";
        else
        {
            int i=0;
            while(t[i]<p[j])
            {
                i++;
            }
           cout<<i+1<<" ";
        }
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/01ms508 KiB
2Time limit exceeded0/0282ms1848 KiB
3Accepted2/22ms320 KiB
4Accepted2/22ms332 KiB
5Accepted2/21ms320 KiB
6Accepted3/31ms320 KiB
7Accepted3/31ms320 KiB
8Accepted3/31ms320 KiB
9Time limit exceeded0/2298ms1992 KiB
10Time limit exceeded0/2300ms2020 KiB
11Time limit exceeded0/2284ms1896 KiB
12Time limit exceeded0/2284ms1848 KiB
13Time limit exceeded0/2282ms2028 KiB
14Time limit exceeded0/2284ms1848 KiB
15Time limit exceeded0/2300ms1848 KiB
16Time limit exceeded0/2284ms1848 KiB
17Time limit exceeded0/2287ms1988 KiB
18Time limit exceeded0/2291ms2004 KiB
19Time limit exceeded0/2300ms1984 KiB
20Time limit exceeded0/2289ms1848 KiB
21Time limit exceeded0/2277ms1848 KiB
22Time limit exceeded0/3279ms1848 KiB
23Time limit exceeded0/3300ms1868 KiB
24Time limit exceeded0/3293ms1848 KiB