17322022-12-02 11:11:20bzsofiaZenehallgatáscpp11Time limit exceeded 15/50300ms4332 KiB
#include <iostream>
#include <vector>

using namespace std;

long long i, n, m, ido, ossz, sum, j;

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

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

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

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

        ido=ido%ossz;

        j=1;
        sum=0;
        while (sum<ido)
        {
            sum+=zene[j];
            ++j;
        }

        cout<<j-1<<" ";
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/03ms1812 KiB
2Time limit exceeded0/0300ms2036 KiB
3Accepted2/24ms2220 KiB
4Accepted2/24ms2416 KiB
5Accepted2/24ms2620 KiB
6Accepted3/34ms2868 KiB
7Accepted3/34ms3028 KiB
8Accepted3/34ms3232 KiB
9Time limit exceeded0/2263ms3288 KiB
10Time limit exceeded0/2257ms3496 KiB
11Time limit exceeded0/2266ms3628 KiB
12Time limit exceeded0/2273ms3828 KiB
13Time limit exceeded0/2256ms4048 KiB
14Time limit exceeded0/2268ms3944 KiB
15Time limit exceeded0/2268ms4116 KiB
16Time limit exceeded0/2261ms3948 KiB
17Time limit exceeded0/2254ms4324 KiB
18Time limit exceeded0/2277ms4332 KiB
19Time limit exceeded0/2266ms4156 KiB
20Time limit exceeded0/2264ms4244 KiB
21Time limit exceeded0/2252ms4320 KiB
22Time limit exceeded0/3245ms4324 KiB
23Time limit exceeded0/3270ms4160 KiB
24Time limit exceeded0/3266ms4156 KiB