106712024-04-07 20:45:21VargusZenehallgatáscpp17Time limit exceeded 4/50300ms3936 KiB
#include <iostream>
#include <queue>
#define ll long long

using namespace std;

int main()
{
    ll n, k;
    cin >> n >> k;
    vector <ll> a(n + 1);
    for (ll i = 1; i <= n; ++i)
    {
        cin >> a[i];
        a[i] += a[i - 1];
    }
    ll x;
    for (ll i = 1; i <= k; ++i)
    {
        cin >> x;
        for (ll j = 1; j <= n; ++j)
        {
            if (x <= a[j])
            {
                cout << j << " ";
                break;
            }
            else if (j == n)
            {
                x -= a[j];
                j = 0;
            }
        }
    }

    return 0;
}
/*
3 3
4 4 3
3 10 7
*/
SubtaskSumTestVerdictTimeMemory
base4/50
1Accepted0/03ms1816 KiB
2Time limit exceeded0/0300ms2104 KiB
3Accepted2/2103ms2236 KiB
4Accepted2/2199ms2324 KiB
5Time limit exceeded0/2279ms2416 KiB
6Time limit exceeded0/3261ms2660 KiB
7Time limit exceeded0/3254ms2876 KiB
8Time limit exceeded0/3273ms2984 KiB
9Time limit exceeded0/2261ms2960 KiB
10Time limit exceeded0/2259ms2992 KiB
11Time limit exceeded0/2234ms2920 KiB
12Time limit exceeded0/2270ms2932 KiB
13Time limit exceeded0/2275ms3052 KiB
14Time limit exceeded0/2254ms3124 KiB
15Time limit exceeded0/2270ms3272 KiB
16Time limit exceeded0/2266ms3620 KiB
17Time limit exceeded0/2259ms3416 KiB
18Time limit exceeded0/2270ms3552 KiB
19Time limit exceeded0/2270ms3632 KiB
20Time limit exceeded0/2275ms3624 KiB
21Time limit exceeded0/2261ms3764 KiB
22Time limit exceeded0/3259ms3748 KiB
23Time limit exceeded0/3257ms3700 KiB
24Time limit exceeded0/3270ms3936 KiB