142432025-01-10 10:26:19feheristvanZenehallgatáscpp17Accepted 50/5048ms1356 KiB
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    ios :: sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, k, x, t = 0;
    cin >> n >> k;
    vector <int> v;
    v.resize(n);
    for(int i = 0; i < n; i ++){
        cin >> x;
        t = t + x;
        v[i] = t;
    }
    int h = v[n - 1];
    for(int i = 0; i < k; i ++){
        cin >> x;
        x = x % h;
        cout << lower_bound(v.begin(), v.end(), x) - v.begin() + 1 << " ";
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms316 KiB
2Accepted0/048ms1332 KiB
3Accepted2/21ms320 KiB
4Accepted2/21ms320 KiB
5Accepted2/21ms316 KiB
6Accepted3/31ms316 KiB
7Accepted3/31ms316 KiB
8Accepted3/31ms316 KiB
9Accepted2/248ms1340 KiB
10Accepted2/248ms1332 KiB
11Accepted2/248ms1332 KiB
12Accepted2/248ms1356 KiB
13Accepted2/248ms1356 KiB
14Accepted2/248ms1336 KiB
15Accepted2/248ms1200 KiB
16Accepted2/248ms1344 KiB
17Accepted2/248ms1332 KiB
18Accepted2/246ms1332 KiB
19Accepted2/246ms1332 KiB
20Accepted2/246ms1332 KiB
21Accepted2/246ms1164 KiB
22Accepted3/346ms1268 KiB
23Accepted3/346ms1352 KiB
24Accepted3/346ms1332 KiB