15672022-11-26 20:16:401478Zenehallgatáscpp11Time limit exceeded 0/50300ms4188 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 bS(vector<int> pS, int val)
{
    int i = 1, j = pS.size(), m;
    while (i != j)
    {
        m = i + (j - i) / 2;
        if (pS[m] == val)
        {
            return m;
        }

        else if (pS[m] < val)
        {
            i = m + 1;
        }
        else
        {
            j = m - 1;
        }
    }
    return i;
}

int main()
{
    // ifstream cin("be.txt");
    int n, m;
    cin >> n >> m;
    vector<int> pS(n + 1);
    for (int i = 1; i <= n; i++)
    {
        int a;
        cin >> a;
        pS[i] = pS[i - 1] + a;
    }
    for (int i = 1; i <= m; i++)
    {
        int a;
        cin >> a;
        a = a % pS[n];
        cout << bS(pS, a) << " ";
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Accepted0/03ms1812 KiB
2Time limit exceeded0/0300ms2036 KiB
3Time limit exceeded0/2300ms2332 KiB
4Time limit exceeded0/2261ms2464 KiB
5Time limit exceeded0/2280ms1812 KiB
6Time limit exceeded0/3280ms1880 KiB
7Time limit exceeded0/3256ms1888 KiB
8Time limit exceeded0/3256ms2808 KiB
9Time limit exceeded0/2284ms2876 KiB
10Time limit exceeded0/2266ms3036 KiB
11Time limit exceeded0/2261ms3136 KiB
12Time limit exceeded0/2256ms3364 KiB
13Time limit exceeded0/2266ms3420 KiB
14Time limit exceeded0/2261ms3556 KiB
15Time limit exceeded0/2275ms3568 KiB
16Time limit exceeded0/2266ms3684 KiB
17Time limit exceeded0/2270ms3788 KiB
18Time limit exceeded0/2266ms4000 KiB
19Time limit exceeded0/2266ms4188 KiB
20Time limit exceeded0/2257ms4120 KiB
21Time limit exceeded0/2263ms3984 KiB
22Time limit exceeded0/3261ms3916 KiB
23Time limit exceeded0/3270ms4032 KiB
24Time limit exceeded0/3270ms3984 KiB