17382022-12-02 13:35:551478Zenehallgatáscpp11Accepted 50/5052ms5740 KiB
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

long long i, n, m, ido, poz;

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

    cin>>n>>m;

    vector <long long> zene(n+1);

    for (i=1; i<=n; ++i)
    {
        cin>>zene[i];
        zene[i]+=zene[i-1];
    }

    for (i=1; i<=m; ++i)
    {
        cin>>ido;

        ido=ido%zene[n];

        cout<<lower_bound(zene.begin()+1, zene.end(), ido)-zene.begin()<<" ";
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1828 KiB
2Accepted0/050ms3608 KiB
3Accepted2/22ms2116 KiB
4Accepted2/22ms2308 KiB
5Accepted2/22ms2412 KiB
6Accepted3/33ms2620 KiB
7Accepted3/32ms2696 KiB
8Accepted3/33ms2904 KiB
9Accepted2/252ms4504 KiB
10Accepted2/250ms4768 KiB
11Accepted2/250ms4988 KiB
12Accepted2/250ms4928 KiB
13Accepted2/250ms4924 KiB
14Accepted2/250ms5072 KiB
15Accepted2/250ms5136 KiB
16Accepted2/250ms5324 KiB
17Accepted2/250ms5244 KiB
18Accepted2/248ms5248 KiB
19Accepted2/248ms5244 KiB
20Accepted2/248ms5448 KiB
21Accepted2/248ms5732 KiB
22Accepted3/348ms5736 KiB
23Accepted3/348ms5740 KiB
24Accepted3/348ms5656 KiB