20712022-12-16 12:54:35gkataZenehallgatáscpp17Accepted 50/5048ms5612 KiB
#include <iostream>
//#include <fstream>
#include <vector>
#include <algorithm>

using namespace std;

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

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

int n,i,k,a,s;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin>>n>>k;;

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

    for(i=1;i<=k;++i)
    {
        cin>>a;
        a=a%x[n-1];

        cout<<lower_bound(x.begin(),x.end(),a)-x.begin()+1<<" ";
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1892 KiB
2Accepted0/048ms3264 KiB
3Accepted2/22ms2300 KiB
4Accepted2/23ms2376 KiB
5Accepted2/22ms2508 KiB
6Accepted3/33ms2716 KiB
7Accepted3/33ms2932 KiB
8Accepted3/32ms3016 KiB
9Accepted2/248ms4192 KiB
10Accepted2/248ms4360 KiB
11Accepted2/248ms4544 KiB
12Accepted2/248ms4744 KiB
13Accepted2/248ms4812 KiB
14Accepted2/248ms5068 KiB
15Accepted2/248ms5028 KiB
16Accepted2/248ms5056 KiB
17Accepted2/248ms5240 KiB
18Accepted2/246ms5176 KiB
19Accepted2/248ms5172 KiB
20Accepted2/246ms5276 KiB
21Accepted2/246ms5612 KiB
22Accepted3/346ms5480 KiB
23Accepted3/346ms5536 KiB
24Accepted3/346ms5548 KiB