15722022-11-26 20:44:261478Zenehallgatáscpp11Wrong answer 0/50300ms4904 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();
    while (i <= j)
    {
        int m = i + (j - i) / 2;
        if (pS[m] == val)
            return m;
        if (pS[m] > val && pS[m - 1] < val)
            return m;
        if (pS[m] < val)
            i = m + 1;
        else
            j = m - 1;
    }
}

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;
        cout << bS(pS, a % pS[n]) + 1 << " ";
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/03ms1808 KiB
2Time limit exceeded0/0300ms2052 KiB
3Wrong answer0/24ms2112 KiB
4Wrong answer0/24ms2316 KiB
5Wrong answer0/24ms2520 KiB
6Wrong answer0/34ms2752 KiB
7Wrong answer0/34ms2960 KiB
8Wrong answer0/34ms3068 KiB
9Time limit exceeded0/2268ms3248 KiB
10Time limit exceeded0/2273ms3284 KiB
11Time limit exceeded0/2261ms3384 KiB
12Time limit exceeded0/2237ms3588 KiB
13Time limit exceeded0/2273ms3644 KiB
14Time limit exceeded0/2286ms3716 KiB
15Time limit exceeded0/2266ms3992 KiB
16Time limit exceeded0/2254ms3996 KiB
17Time limit exceeded0/2270ms4220 KiB
18Time limit exceeded0/2268ms4200 KiB
19Time limit exceeded0/2266ms4592 KiB
20Time limit exceeded0/2259ms4556 KiB
21Time limit exceeded0/2250ms4560 KiB
22Time limit exceeded0/3254ms4564 KiB
23Time limit exceeded0/3266ms4904 KiB
24Time limit exceeded0/3250ms4600 KiB