81452024-01-12 14:34:47norbertvidaZenehallgatáscpp17Accepted 50/50104ms13676 KiB
#include <bits/stdc++.h>

using namespace std;

int N, K, Ts, i, t;
map<int, int> L;

int main() {
    iostream::sync_with_stdio(0);
    cin.tie(0);
    cin >> N >> K;
    for(i = 0; i < N; ++i) {
        cin >> t;
        Ts += t;
        L[Ts] = i;
    }
    for(i = 0; i < K; ++i) {
        cin >> t;
        t %= Ts;
        cout << L.lower_bound(t)->second + 1 << " ";
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1896 KiB
2Accepted0/0101ms11592 KiB
3Accepted2/23ms2476 KiB
4Accepted2/23ms2684 KiB
5Accepted2/23ms2900 KiB
6Accepted3/33ms3112 KiB
7Accepted3/33ms3072 KiB
8Accepted3/33ms3364 KiB
9Accepted2/2100ms12660 KiB
10Accepted2/298ms12664 KiB
11Accepted2/297ms12652 KiB
12Accepted2/297ms12852 KiB
13Accepted2/297ms12660 KiB
14Accepted2/297ms12876 KiB
15Accepted2/297ms12868 KiB
16Accepted2/297ms12864 KiB
17Accepted2/298ms13228 KiB
18Accepted2/2101ms13012 KiB
19Accepted2/2101ms13236 KiB
20Accepted2/297ms13372 KiB
21Accepted2/297ms13236 KiB
22Accepted3/3104ms13368 KiB
23Accepted3/3104ms13496 KiB
24Accepted3/3104ms13676 KiB