16612022-12-01 12:52:021478Zenehallgatáscpp11Time limit exceeded 32/50272ms4688 KiB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> p32;
typedef pair<ll, ll> p64;
typedef pair<double, double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int>> vv32;
typedef vector<vector<ll>> vv64;
typedef vector<vector<p64>> vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 998244353;
double eps = 1e-12;
#define forn(i, e) for (ll i = 0; i < e; i++)
#define forsn(i, s, e) for (ll i = s; i < e; i++)
#define rforn(i, s) for (ll i = s; i >= 0; i--)
#define rforsn(i, s, e) for (ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout << #x << " = " << x << ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 2e18
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())

int main()
{

    int n;
    cin >> n;

    vector<int> 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(), prefixSum.end(), a) - prefixSum.begin() << " ";
    }
    

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base32/50
1Accepted0/03ms1720 KiB
2Time limit exceeded0/0245ms2552 KiB
3Accepted2/24ms2056 KiB
4Accepted2/24ms2108 KiB
5Accepted2/24ms2240 KiB
6Accepted3/34ms2444 KiB
7Accepted3/34ms2556 KiB
8Accepted3/34ms2796 KiB
9Accepted2/2194ms3432 KiB
10Accepted2/2193ms3496 KiB
11Accepted2/2190ms3496 KiB
12Accepted2/2193ms3624 KiB
13Accepted2/2187ms3700 KiB
14Time limit exceeded0/2254ms2768 KiB
15Time limit exceeded0/2261ms2884 KiB
16Accepted2/2194ms4280 KiB
17Time limit exceeded0/2266ms3080 KiB
18Time limit exceeded0/2223ms3204 KiB
19Time limit exceeded0/2263ms3300 KiB
20Accepted2/2184ms4484 KiB
21Time limit exceeded0/2270ms3412 KiB
22Accepted3/3181ms4456 KiB
23Time limit exceeded0/3272ms3412 KiB
24Time limit exceeded0/3238ms4688 KiB