67252023-12-18 10:30:27zsebiZenehallgatáscpp17Accepted 50/5054ms5484 KiB
// zenehallgatas.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <queue>

#define ll long long 
using namespace std;


ll n, k;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> k;
    vector<ll>x(n);
    for (int i = 1; i <= n; ++i)
    {
        cin >>x[i-1];
        if (i - 1)
            x[i - 1] += x[i - 2];
    }
    for (int i = 1; i <= k; ++i)
    {
        ll a;
        cin >> a;
        a %= x[n - 1];
        cout << lower_bound(x.begin(), x.end(), a) - x.begin()+1 << " ";
    }
    return 0;
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1976 KiB
2Accepted0/054ms3600 KiB
3Accepted2/23ms2284 KiB
4Accepted2/23ms2572 KiB
5Accepted2/23ms2660 KiB
6Accepted3/33ms2864 KiB
7Accepted3/33ms3016 KiB
8Accepted3/33ms3212 KiB
9Accepted2/254ms4900 KiB
10Accepted2/254ms4892 KiB
11Accepted2/254ms4892 KiB
12Accepted2/254ms4904 KiB
13Accepted2/252ms4904 KiB
14Accepted2/252ms4904 KiB
15Accepted2/252ms4892 KiB
16Accepted2/252ms5132 KiB
17Accepted2/252ms5104 KiB
18Accepted2/252ms5324 KiB
19Accepted2/252ms5368 KiB
20Accepted2/252ms5484 KiB
21Accepted2/250ms5388 KiB
22Accepted3/350ms5404 KiB
23Accepted3/350ms5420 KiB
24Accepted3/350ms5328 KiB