17352022-12-02 13:28:401478Zenehallgatáscpp11Time limit exceeded 33/50275ms5588 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;

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

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base33/50
1Accepted0/03ms1812 KiB
2Time limit exceeded0/0266ms3356 KiB
3Accepted2/24ms2124 KiB
4Accepted2/24ms2320 KiB
5Accepted2/24ms2516 KiB
6Accepted3/34ms2724 KiB
7Accepted3/34ms2804 KiB
8Accepted3/34ms2932 KiB
9Accepted2/2196ms4348 KiB
10Time limit exceeded0/2221ms4348 KiB
11Time limit exceeded0/2224ms4476 KiB
12Time limit exceeded0/2275ms4552 KiB
13Accepted2/2197ms4684 KiB
14Accepted2/2190ms4900 KiB
15Accepted2/2193ms4956 KiB
16Time limit exceeded0/2224ms5088 KiB
17Time limit exceeded0/2231ms5164 KiB
18Time limit exceeded0/2225ms5168 KiB
19Time limit exceeded0/2223ms5376 KiB
20Accepted2/2184ms5368 KiB
21Accepted2/2186ms5516 KiB
22Accepted3/3186ms5588 KiB
23Accepted3/3187ms5572 KiB
24Time limit exceeded0/3241ms4324 KiB