15732022-11-26 20:52:341478Zenehallgatáscpp11Time limit exceeded 34/50263ms4944 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, 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--;
        cout << int(upper_bound(pS.begin(), pS.end(), (a % pS[n])) - pS.begin()) << " ";
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base34/50
1Accepted0/03ms1816 KiB
2Accepted0/0197ms2760 KiB
3Accepted2/24ms2208 KiB
4Accepted2/24ms2412 KiB
5Accepted2/24ms2496 KiB
6Accepted3/34ms2616 KiB
7Accepted3/34ms2692 KiB
8Accepted3/34ms2824 KiB
9Time limit exceeded0/2206ms3600 KiB
10Time limit exceeded0/2238ms2656 KiB
11Time limit exceeded0/2217ms2884 KiB
12Time limit exceeded0/2261ms2936 KiB
13Accepted2/2194ms4092 KiB
14Time limit exceeded0/2259ms4128 KiB
15Time limit exceeded0/2256ms3160 KiB
16Time limit exceeded0/2263ms4296 KiB
17Accepted2/2193ms4108 KiB
18Accepted2/2189ms4240 KiB
19Accepted2/2193ms4456 KiB
20Accepted2/2188ms4540 KiB
21Time limit exceeded0/2202ms4520 KiB
22Accepted3/3187ms4520 KiB
23Accepted3/3187ms4744 KiB
24Accepted3/3189ms4944 KiB