79102024-01-11 20:21:42CsongiZenehallgatáscpp17Accepted 50/5054ms4512 KiB
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

long long n, i, k, a,ido;
vector<int>x;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n>>k;
    for (i = 1; i <= n; ++i)
    {
        cin >> a;
        ido += a;
        x.push_back(ido);
    }
    for (i = 1; i <= k; ++i)
    {
        cin >> a;
        a = a % x[n - 1];
        cout << lower_bound(x.begin(), x.end(), a) - x.begin()+1<<" ";
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1892 KiB
2Accepted0/052ms3388 KiB
3Accepted2/23ms2344 KiB
4Accepted2/23ms2696 KiB
5Accepted2/23ms2648 KiB
6Accepted3/33ms2808 KiB
7Accepted3/33ms2820 KiB
8Accepted3/33ms3040 KiB
9Accepted2/252ms4308 KiB
10Accepted2/252ms4332 KiB
11Accepted2/252ms4260 KiB
12Accepted2/254ms4256 KiB
13Accepted2/252ms4280 KiB
14Accepted2/252ms4260 KiB
15Accepted2/252ms4256 KiB
16Accepted2/252ms4512 KiB
17Accepted2/252ms4468 KiB
18Accepted2/252ms4468 KiB
19Accepted2/252ms4480 KiB
20Accepted2/250ms4476 KiB
21Accepted2/250ms4472 KiB
22Accepted3/350ms4468 KiB
23Accepted3/350ms4464 KiB
24Accepted3/350ms4504 KiB