120822024-12-01 16:56:36ruffbrigiZenehallgatáscpp17Time limit exceeded 15/50300ms1200 KiB
#include <iostream>

using namespace std;

int main()
{
    long long n,k,s=0;
    cin>>n;
    cin>>k;
    int t[n],p[k];
    for(int i=0;i<=n-1;i++)
    {
        cin>>t[i];
        s=s+t[i];
    }
    for(int j=0;j<=k-1;j++)
    {
        cin>>p[j];
        p[j]=p[j]%s;
    }
    for(int j=0;j<=k-1;j++)
    {
        if(p[j]==0) cout<<n<<" ";
        else
        {
            int i=0;
            int h=t[0];
            while(h<p[j])
            {
                i++;
                h=h+t[i];
            }
           cout<<i+1<<" ";
        }
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/01ms320 KiB
2Time limit exceeded0/0282ms1036 KiB
3Accepted2/22ms508 KiB
4Accepted2/22ms508 KiB
5Accepted2/22ms320 KiB
6Accepted3/32ms320 KiB
7Accepted3/32ms628 KiB
8Accepted3/32ms320 KiB
9Time limit exceeded0/2300ms1200 KiB
10Time limit exceeded0/2300ms1080 KiB
11Time limit exceeded0/2300ms1084 KiB
12Time limit exceeded0/2273ms1080 KiB
13Time limit exceeded0/2286ms1016 KiB
14Time limit exceeded0/2286ms1080 KiB
15Time limit exceeded0/2300ms992 KiB
16Time limit exceeded0/2287ms1080 KiB
17Time limit exceeded0/2284ms1080 KiB
18Time limit exceeded0/2284ms1152 KiB
19Time limit exceeded0/2300ms972 KiB
20Time limit exceeded0/2284ms1020 KiB
21Time limit exceeded0/2273ms1080 KiB
22Time limit exceeded0/3273ms984 KiB
23Time limit exceeded0/3300ms1120 KiB
24Time limit exceeded0/3287ms1080 KiB