30902023-02-15 12:48:01tamasmarkZenehallgatáscpp17Elfogadva 50/5050ms5108 KiB
// zenehalgatas.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#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;
}
/*
3 2
2 4 3
6 10

*/
// 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/03ms1764 KiB
2Elfogadva0/050ms3264 KiB
3Elfogadva2/23ms2348 KiB
4Elfogadva2/23ms2688 KiB
5Elfogadva2/23ms2644 KiB
6Elfogadva3/33ms2732 KiB
7Elfogadva3/33ms2852 KiB
8Elfogadva3/33ms3064 KiB
9Elfogadva2/248ms4556 KiB
10Elfogadva2/248ms4432 KiB
11Elfogadva2/250ms4680 KiB
12Elfogadva2/250ms4636 KiB
13Elfogadva2/250ms4636 KiB
14Elfogadva2/250ms4924 KiB
15Elfogadva2/248ms4920 KiB
16Elfogadva2/248ms4868 KiB
17Elfogadva2/248ms4784 KiB
18Elfogadva2/248ms4780 KiB
19Elfogadva2/248ms5044 KiB
20Elfogadva2/248ms5108 KiB
21Elfogadva2/246ms5040 KiB
22Elfogadva3/348ms5040 KiB
23Elfogadva3/346ms5072 KiB
24Elfogadva3/346ms5076 KiB