81392024-01-12 14:22:34norbertvidaZenehallgatáscpp17Accepted 50/50114ms14516 KiB
#include <bits/stdc++.h>

using namespace std;

int main() {
    iostream::sync_with_stdio(0);
    cin.tie(0);
    int N, K;
    cin >> N >> K;
    vector<int> P(N);
    unsigned long long int Ts = 0;
    map<int, int> L;
    for(int i = 0, t; i < N; i++) {
        cin >> t;
        Ts += t;
        L[Ts] = i;
    }
    for(int i = 0, t; i < K; i++) {
        cin >> t;
        t %= Ts;
        cout << L.lower_bound(t)->second + 1 << " ";
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1832 KiB
2Accepted0/0108ms12332 KiB
3Accepted2/23ms2412 KiB
4Accepted2/23ms2712 KiB
5Accepted2/23ms2692 KiB
6Accepted3/33ms2712 KiB
7Accepted3/33ms2960 KiB
8Accepted3/33ms2896 KiB
9Accepted2/2114ms13244 KiB
10Accepted2/2101ms13396 KiB
11Accepted2/2108ms13508 KiB
12Accepted2/2103ms13404 KiB
13Accepted2/2103ms13600 KiB
14Accepted2/2101ms13608 KiB
15Accepted2/2103ms13820 KiB
16Accepted2/2100ms14028 KiB
17Accepted2/2100ms14028 KiB
18Accepted2/2104ms14028 KiB
19Accepted2/2101ms14244 KiB
20Accepted2/2101ms14240 KiB
21Accepted2/2104ms14328 KiB
22Accepted3/3103ms14320 KiB
23Accepted3/3104ms14316 KiB
24Accepted3/3101ms14516 KiB