20582022-12-16 07:41:14gkataZenehallgatáscpp17Time limit exceeded 15/50300ms5104 KiB
#include <iostream>
//#include <fstream>
#include <vector>

using namespace std;

//ifstream cin("zene.in");
//ofstream cout("zene.out");

vector <int>x;
vector <int>y;

int n,i,k,a,s,b,p,u,j;

int main()
{
    cin>>n>>k;

    for(i=1;i<=n;++i)
    {
        cin>>a;
        x.push_back(a);
        s+=a;
    }

    for(i=1;i<=k;++i)
       {
           cin>>b;
           y.push_back(b);
       }

    while(j<y.size())
    {
        u=y[j]%s;
        p=0;
        for(i=0;i<x.size();++i)
        {
            p+=x[i];
            if(u<=p)
            {
                cout<<i+1<<" ";
                break;
            }
        }
        ++j;
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/03ms2004 KiB
2Time limit exceeded0/0300ms2512 KiB
3Accepted2/24ms2380 KiB
4Accepted2/24ms2528 KiB
5Accepted2/23ms2724 KiB
6Accepted3/33ms2980 KiB
7Accepted3/33ms2876 KiB
8Accepted3/33ms2880 KiB
9Time limit exceeded0/2300ms3356 KiB
10Time limit exceeded0/2248ms3556 KiB
11Time limit exceeded0/2252ms3532 KiB
12Time limit exceeded0/2254ms3652 KiB
13Time limit exceeded0/2273ms3784 KiB
14Time limit exceeded0/2250ms4052 KiB
15Time limit exceeded0/2270ms4444 KiB
16Time limit exceeded0/2266ms4004 KiB
17Time limit exceeded0/2266ms4260 KiB
18Time limit exceeded0/2254ms4424 KiB
19Time limit exceeded0/2225ms4552 KiB
20Time limit exceeded0/2261ms4552 KiB
21Time limit exceeded0/2261ms4748 KiB
22Time limit exceeded0/3266ms4604 KiB
23Time limit exceeded0/3257ms4692 KiB
24Time limit exceeded0/3273ms5104 KiB