106702024-04-07 20:35:04VargusZenehallgatáscpp17Time limit exceeded 4/50286ms12748 KiB
#include <iostream>
#include <queue>
#define ll long long

using namespace std;

vector <ll> a;
ll n, x;
void f(ll i)
{
    if (x <= 0)
    {
        cout << i - 1 << " ";
        return;
    }
    x -= a[i];
    if (i == n && x > 0)
        i = 1;
    else
        ++i;
    f(i);
}

int main()
{
    ll k;
    cin >> n >> k;
    a.resize(n + 1);
    for (ll i = 1; i <= n; ++i)
        cin >> a[i];
    for (ll i = 1; i <= k; ++i)
    {
        cin >> x;
        f(1);
    }

    return 0;
}
/*
3 3
4 4 3
3 10 7
*/
SubtaskSumTestVerdictTimeMemory
base4/50
1Accepted0/03ms1880 KiB
2Time limit exceeded0/0250ms2700 KiB
3Accepted2/281ms2912 KiB
4Accepted2/2153ms3144 KiB
5Time limit exceeded0/2261ms3356 KiB
6Time limit exceeded0/3268ms3736 KiB
7Time limit exceeded0/3277ms3708 KiB
8Time limit exceeded0/3273ms3944 KiB
9Time limit exceeded0/2240ms4636 KiB
10Time limit exceeded0/2266ms5552 KiB
11Time limit exceeded0/2261ms6184 KiB
12Time limit exceeded0/2256ms6768 KiB
13Time limit exceeded0/2250ms7656 KiB
14Time limit exceeded0/2250ms8328 KiB
15Time limit exceeded0/2264ms8816 KiB
16Time limit exceeded0/2261ms9504 KiB
17Time limit exceeded0/2286ms9964 KiB
18Time limit exceeded0/2246ms10428 KiB
19Time limit exceeded0/2261ms10964 KiB
20Time limit exceeded0/2273ms11452 KiB
21Time limit exceeded0/2257ms11652 KiB
22Time limit exceeded0/3268ms12108 KiB
23Time limit exceeded0/3268ms12404 KiB
24Time limit exceeded0/3250ms12748 KiB