17422022-12-02 13:40:171478Zenehallgatáscpp11Time limit exceeded 29/50270ms5924 KiB
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

long long n, m, i, a;

int main()
{

    cin >> n;
    cin >> m;

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

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

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

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base29/50
1Accepted0/03ms1680 KiB
2Accepted0/0192ms3288 KiB
3Accepted2/24ms2144 KiB
4Accepted2/24ms2260 KiB
5Accepted2/24ms2376 KiB
6Accepted3/34ms2508 KiB
7Accepted3/34ms2656 KiB
8Accepted3/34ms2860 KiB
9Accepted2/2193ms4408 KiB
10Time limit exceeded0/2212ms4612 KiB
11Time limit exceeded0/2250ms4812 KiB
12Time limit exceeded0/2266ms3720 KiB
13Accepted2/2190ms5108 KiB
14Time limit exceeded0/2245ms5184 KiB
15Accepted2/2189ms5184 KiB
16Accepted2/2189ms5184 KiB
17Accepted2/2192ms5280 KiB
18Accepted2/2188ms5220 KiB
19Time limit exceeded0/2256ms3992 KiB
20Time limit exceeded0/2243ms5512 KiB
21Accepted2/2186ms5732 KiB
22Time limit exceeded0/3254ms4460 KiB
23Time limit exceeded0/3231ms5924 KiB
24Time limit exceeded0/3270ms4632 KiB