16602022-12-01 12:50:571478Zenehallgatáscpp11Time limit exceeded 36/50254ms4804 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()
{
    // ifstream cin("be.txt");

    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];
    }

    while (m--)
    {
        int a;
        cin >> a;
        a %= prefixSum[n];
        cout << lower_bound(prefixSum.begin(), prefixSum.end(), a) - prefixSum.begin() << " ";
        
    }
    cout << ln;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base36/50
1Accepted0/03ms1812 KiB
2Accepted0/0193ms2764 KiB
3Accepted2/24ms2084 KiB
4Accepted2/24ms2328 KiB
5Accepted2/24ms2424 KiB
6Accepted3/34ms2624 KiB
7Accepted3/34ms2728 KiB
8Accepted3/34ms2796 KiB
9Accepted2/2192ms3628 KiB
10Accepted2/2194ms3828 KiB
11Accepted2/2194ms3904 KiB
12Accepted2/2189ms3908 KiB
13Time limit exceeded0/2209ms4036 KiB
14Time limit exceeded0/2254ms4276 KiB
15Accepted2/2187ms4336 KiB
16Time limit exceeded0/2238ms4440 KiB
17Accepted2/2192ms4540 KiB
18Time limit exceeded0/2231ms4544 KiB
19Accepted2/2186ms4524 KiB
20Accepted2/2182ms4620 KiB
21Accepted2/2187ms4516 KiB
22Accepted3/3181ms4520 KiB
23Time limit exceeded0/3241ms4516 KiB
24Time limit exceeded0/3209ms4804 KiB