38252023-03-03 10:22:03ZsofiaKeresztelyZenehallgatáscpp14Accepted 50/50104ms13468 KiB
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define fi first
#define se second

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, k, l=0;
    cin >> n >> k;
    set<pii> s;
    for (int i=1; i<=n; i++){
        int t;
        cin >> t;
        l += t;
        s.insert({l, i});
    }
    while (k--){
        int t;
        cin >> t;
        t %= l;
        if (!t) t = l;
        cout << (*s.lower_bound({t, 0})).se << " ";
    }
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1828 KiB
2Accepted0/098ms11568 KiB
3Accepted2/23ms2420 KiB
4Accepted2/23ms2732 KiB
5Accepted2/23ms2684 KiB
6Accepted3/33ms3136 KiB
7Accepted3/33ms3160 KiB
8Accepted3/33ms3248 KiB
9Accepted2/297ms12712 KiB
10Accepted2/2103ms12844 KiB
11Accepted2/298ms12964 KiB
12Accepted2/2104ms13260 KiB
13Accepted2/297ms13252 KiB
14Accepted2/297ms13240 KiB
15Accepted2/294ms13360 KiB
16Accepted2/2101ms13188 KiB
17Accepted2/298ms13276 KiB
18Accepted2/296ms13424 KiB
19Accepted2/2101ms13260 KiB
20Accepted2/297ms13244 KiB
21Accepted2/296ms13244 KiB
22Accepted3/394ms13252 KiB
23Accepted3/396ms13340 KiB
24Accepted3/396ms13468 KiB