15252022-11-22 00:34:29TomaSajtZenehallgatáscpp14Accepted 50/5050ms5884 KiB
#include <bits/stdc++.h>
#define speed ios::sync_with_stdio(0);cin.tie(0)
using namespace std;
typedef long long ll;

int main() {
    speed;
    int n, k;
    cin >> n >> k;
    vector<ll> v(n);
    ll tot = 0;
    for (int i = 0; i < n; i++) {
        int a; cin >> a;
        v[i] = tot;
        tot += a;
    }
    while (k--) {
        int q; cin >> q;
        cout << upper_bound(v.begin(), v.end(), (q - 1) % tot) - v.begin() << ' ';
    }
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1824 KiB
2Accepted0/050ms3500 KiB
3Accepted2/23ms2240 KiB
4Accepted2/23ms2444 KiB
5Accepted2/22ms2932 KiB
6Accepted3/32ms2796 KiB
7Accepted3/32ms3004 KiB
8Accepted3/32ms3228 KiB
9Accepted2/250ms4784 KiB
10Accepted2/250ms5000 KiB
11Accepted2/250ms4872 KiB
12Accepted2/250ms4860 KiB
13Accepted2/248ms4868 KiB
14Accepted2/250ms5072 KiB
15Accepted2/250ms5332 KiB
16Accepted2/250ms5520 KiB
17Accepted2/250ms5504 KiB
18Accepted2/248ms5480 KiB
19Accepted2/248ms5544 KiB
20Accepted2/248ms5472 KiB
21Accepted2/248ms5484 KiB
22Accepted3/348ms5472 KiB
23Accepted3/348ms5672 KiB
24Accepted3/348ms5884 KiB