17402022-12-02 13:39:121478Zenehallgatáscpp11Time limit exceeded 23/50266ms5436 KiB
#include <bits/stdc++.h>

using namespace std;

long long n, m, i, a;

int main()
{

    cin >> n;
    cin >> 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
base23/50
1Accepted0/03ms1808 KiB
2Accepted0/0196ms3416 KiB
3Accepted2/24ms2276 KiB
4Accepted2/24ms2476 KiB
5Accepted2/24ms2628 KiB
6Accepted3/34ms2700 KiB
7Accepted3/34ms2828 KiB
8Accepted3/34ms3028 KiB
9Accepted2/2194ms4456 KiB
10Time limit exceeded0/2204ms4580 KiB
11Time limit exceeded0/2250ms4820 KiB
12Accepted2/2199ms4872 KiB
13Time limit exceeded0/2209ms4844 KiB
14Time limit exceeded0/2256ms4844 KiB
15Time limit exceeded0/2254ms3620 KiB
16Time limit exceeded0/2210ms4924 KiB
17Time limit exceeded0/2209ms4964 KiB
18Time limit exceeded0/2238ms5048 KiB
19Accepted2/2194ms5404 KiB
20Accepted2/2185ms5336 KiB
21Time limit exceeded0/2217ms5420 KiB
22Time limit exceeded0/3266ms4212 KiB
23Time limit exceeded0/3236ms5436 KiB
24Time limit exceeded0/3234ms5340 KiB