17342022-12-02 11:27:48bzsofiaZenehallgatáscpp11Accepted 50/5050ms5928 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/03ms1700 KiB
2Accepted0/050ms3348 KiB
3Accepted2/23ms2084 KiB
4Accepted2/23ms2308 KiB
5Accepted2/23ms2508 KiB
6Accepted3/32ms2584 KiB
7Accepted3/32ms2968 KiB
8Accepted3/32ms2940 KiB
9Accepted2/250ms4616 KiB
10Accepted2/250ms4608 KiB
11Accepted2/250ms4876 KiB
12Accepted2/250ms4956 KiB
13Accepted2/250ms5116 KiB
14Accepted2/250ms5328 KiB
15Accepted2/250ms5536 KiB
16Accepted2/250ms5660 KiB
17Accepted2/250ms5744 KiB
18Accepted2/248ms5660 KiB
19Accepted2/248ms5648 KiB
20Accepted2/248ms5664 KiB
21Accepted2/248ms5900 KiB
22Accepted3/348ms5892 KiB
23Accepted3/348ms5856 KiB
24Accepted3/348ms5928 KiB