20572022-12-16 07:35:16gkataZenehallgatáscpp17Time limit exceeded 15/50300ms4648 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;

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);
       }

    for(auto &e:y)
    {
        u=e%s;
        p=0;
        for(i=0;i<x.size();++i)
        {
            p+=x[i];
            if(u<=p)
            {
                cout<<i+1<<" ";
                break;
            }
        }
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/03ms1876 KiB
2Time limit exceeded0/0248ms2428 KiB
3Accepted2/24ms2284 KiB
4Accepted2/24ms2492 KiB
5Accepted2/23ms2712 KiB
6Accepted3/33ms2920 KiB
7Accepted3/33ms3052 KiB
8Accepted3/33ms3256 KiB
9Time limit exceeded0/2300ms3808 KiB
10Time limit exceeded0/2261ms3812 KiB
11Time limit exceeded0/2238ms3984 KiB
12Time limit exceeded0/2261ms4020 KiB
13Time limit exceeded0/2246ms4136 KiB
14Time limit exceeded0/2250ms4168 KiB
15Time limit exceeded0/2266ms4232 KiB
16Time limit exceeded0/2261ms4248 KiB
17Time limit exceeded0/2264ms4364 KiB
18Time limit exceeded0/2261ms4448 KiB
19Time limit exceeded0/2266ms4452 KiB
20Time limit exceeded0/2266ms4528 KiB
21Time limit exceeded0/2273ms4468 KiB
22Time limit exceeded0/3261ms4600 KiB
23Time limit exceeded0/3261ms4648 KiB
24Time limit exceeded0/3257ms4644 KiB