17432022-12-02 13:41:191478Zenehallgatáscpp11Time limit exceeded 28/50282ms5600 KiB
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

long long i, n, m, a;

int main()
{

    cin >> n >> m;

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

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

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

        a = a % prefixSum[n];

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

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base28/50
1Accepted0/03ms1812 KiB
2Accepted0/0194ms3360 KiB
3Accepted2/24ms2112 KiB
4Accepted2/24ms2316 KiB
5Accepted2/24ms2556 KiB
6Accepted3/34ms2596 KiB
7Accepted3/34ms2596 KiB
8Accepted3/34ms2828 KiB
9Time limit exceeded0/2228ms4148 KiB
10Time limit exceeded0/2252ms4144 KiB
11Accepted2/2194ms4148 KiB
12Accepted2/2194ms4276 KiB
13Time limit exceeded0/2273ms3372 KiB
14Time limit exceeded0/2246ms4732 KiB
15Time limit exceeded0/2282ms3604 KiB
16Accepted2/2190ms4976 KiB
17Time limit exceeded0/2243ms3608 KiB
18Time limit exceeded0/2222ms5184 KiB
19Accepted2/2190ms5324 KiB
20Accepted2/2188ms5384 KiB
21Time limit exceeded0/2231ms4076 KiB
22Accepted3/3182ms5600 KiB
23Time limit exceeded0/3250ms4292 KiB
24Time limit exceeded0/3270ms4484 KiB