16582022-12-01 12:49:461478Zenehallgatáscpp11Time limit exceeded 25/50287ms5192 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];
        if (a == 0)
            cout << n << " ";
        else
        {
            cout << lower_bound(prefixSum.begin(), prefixSum.end(), a) - prefixSum.begin() << " ";
        }
    }
    cout<<ln;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base25/50
1Accepted0/03ms2092 KiB
2Time limit exceeded0/0287ms2756 KiB
3Accepted2/24ms2256 KiB
4Accepted2/24ms2424 KiB
5Accepted2/24ms2628 KiB
6Accepted3/34ms2700 KiB
7Accepted3/34ms2700 KiB
8Accepted3/34ms2828 KiB
9Accepted2/2194ms3716 KiB
10Accepted2/2200ms3916 KiB
11Accepted2/2194ms4124 KiB
12Time limit exceeded0/2263ms3088 KiB
13Time limit exceeded0/2257ms3236 KiB
14Time limit exceeded0/2246ms4600 KiB
15Accepted2/2190ms4732 KiB
16Time limit exceeded0/2238ms4632 KiB
17Time limit exceeded0/2206ms4884 KiB
18Accepted2/2185ms4980 KiB
19Time limit exceeded0/2244ms4920 KiB
20Time limit exceeded0/2218ms5132 KiB
21Time limit exceeded0/2259ms4268 KiB
22Time limit exceeded0/3246ms5192 KiB
23Time limit exceeded0/3273ms4128 KiB
24Time limit exceeded0/3264ms4184 KiB