81402024-01-12 14:24:30norbertvidaZenehallgatáscpp17Accepted 50/50105ms13860 KiB
#include <bits/stdc++.h>

using namespace std;

int i, t;

int main() {
    iostream::sync_with_stdio(0);
    cin.tie(0);
    int N, K;
    cin >> N >> K;
    int Ts = 0;
    map<int, int> L;
    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/03ms1824 KiB
2Accepted0/0104ms11580 KiB
3Accepted2/23ms2564 KiB
4Accepted2/23ms2624 KiB
5Accepted2/23ms3076 KiB
6Accepted3/33ms2804 KiB
7Accepted3/33ms2924 KiB
8Accepted3/33ms3160 KiB
9Accepted2/2101ms12704 KiB
10Accepted2/2101ms12844 KiB
11Accepted2/2104ms12908 KiB
12Accepted2/2101ms13028 KiB
13Accepted2/2101ms12920 KiB
14Accepted2/2100ms12980 KiB
15Accepted2/2101ms12908 KiB
16Accepted2/298ms12908 KiB
17Accepted2/298ms13120 KiB
18Accepted2/297ms13128 KiB
19Accepted2/297ms13124 KiB
20Accepted2/297ms13328 KiB
21Accepted2/2105ms13540 KiB
22Accepted3/3100ms13680 KiB
23Accepted3/398ms13544 KiB
24Accepted3/3101ms13860 KiB