67252023-12-18 10:30:27zsebiZenehallgatáscpp17Elfogadva 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
RészfeladatÖsszpontTesztVerdiktIdőMemória
base50/50
1Elfogadva0/03ms1976 KiB
2Elfogadva0/054ms3600 KiB
3Elfogadva2/23ms2284 KiB
4Elfogadva2/23ms2572 KiB
5Elfogadva2/23ms2660 KiB
6Elfogadva3/33ms2864 KiB
7Elfogadva3/33ms3016 KiB
8Elfogadva3/33ms3212 KiB
9Elfogadva2/254ms4900 KiB
10Elfogadva2/254ms4892 KiB
11Elfogadva2/254ms4892 KiB
12Elfogadva2/254ms4904 KiB
13Elfogadva2/252ms4904 KiB
14Elfogadva2/252ms4904 KiB
15Elfogadva2/252ms4892 KiB
16Elfogadva2/252ms5132 KiB
17Elfogadva2/252ms5104 KiB
18Elfogadva2/252ms5324 KiB
19Elfogadva2/252ms5368 KiB
20Elfogadva2/252ms5484 KiB
21Elfogadva2/250ms5388 KiB
22Elfogadva3/350ms5404 KiB
23Elfogadva3/350ms5420 KiB
24Elfogadva3/350ms5328 KiB