17362022-12-02 13:33:071478Zenehallgatáscpp11Time limit exceeded 35/50275ms5916 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{

    int n;
    cin >> n;

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

    int m;
    cin >> m;

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

    int a;

    for (int i = 1; i <= m; i++)
    {
        cin >> a;
        a %= prefixSum[n];
        cout << lower_bound(prefixSum.begin() + 1, prefixSum.end(), a) - prefixSum.begin() << " ";
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base35/50
1Accepted0/03ms1816 KiB
2Accepted0/0195ms3360 KiB
3Accepted2/24ms2220 KiB
4Accepted2/24ms2352 KiB
5Accepted2/24ms2528 KiB
6Accepted3/34ms2756 KiB
7Accepted3/34ms2828 KiB
8Accepted3/34ms3076 KiB
9Time limit exceeded0/2275ms3208 KiB
10Accepted2/2190ms4728 KiB
11Accepted2/2193ms4792 KiB
12Time limit exceeded0/2256ms4788 KiB
13Time limit exceeded0/2275ms4876 KiB
14Accepted2/2190ms5060 KiB
15Time limit exceeded0/2272ms3836 KiB
16Accepted2/2193ms5092 KiB
17Accepted2/2197ms5292 KiB
18Time limit exceeded0/2239ms5372 KiB
19Accepted2/2184ms5456 KiB
20Time limit exceeded0/2248ms5456 KiB
21Accepted2/2184ms5556 KiB
22Accepted3/3187ms5496 KiB
23Time limit exceeded0/3240ms5724 KiB
24Accepted3/3184ms5916 KiB