121932024-12-07 22:27:32KissCsongor777Zenehallgatáscpp17Time limit exceeded 15/50300ms844 KiB
#include <iostream>

using namespace std;

int P[100001];

int main()
{
    int n,k,s=0,m,x,j;
    cin>>n>>k;
    for(int i=1; i<=n; i++){cin>>P[i];s+=P[i];}
    for(int i=1; i<=k; i++)
        {
            cin>>x;
            m=x%s;
            if(m!=0)
            {

            j=1;
            while(m>0)
            {
                m-=P[j];
                j++;
            }
            cout<<j-1<<" ";
            }
            else cout<<n<<" ";
        }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/01ms512 KiB
2Time limit exceeded0/0280ms796 KiB
3Accepted2/24ms320 KiB
4Accepted2/24ms320 KiB
5Accepted2/23ms320 KiB
6Accepted3/33ms320 KiB
7Accepted3/33ms508 KiB
8Accepted3/33ms320 KiB
9Time limit exceeded0/2300ms808 KiB
10Time limit exceeded0/2300ms784 KiB
11Time limit exceeded0/2300ms824 KiB
12Time limit exceeded0/2284ms820 KiB
13Time limit exceeded0/2286ms828 KiB
14Time limit exceeded0/2287ms612 KiB
15Time limit exceeded0/2300ms828 KiB
16Time limit exceeded0/2284ms824 KiB
17Time limit exceeded0/2282ms824 KiB
18Time limit exceeded0/2284ms824 KiB
19Time limit exceeded0/2300ms824 KiB
20Time limit exceeded0/2291ms808 KiB
21Time limit exceeded0/2282ms824 KiB
22Time limit exceeded0/3282ms844 KiB
23Time limit exceeded0/3300ms824 KiB
24Time limit exceeded0/3280ms824 KiB