30902023-02-15 12:48:01tamasmarkZenehallgatáscpp17Accepted 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
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1764 KiB
2Accepted0/050ms3264 KiB
3Accepted2/23ms2348 KiB
4Accepted2/23ms2688 KiB
5Accepted2/23ms2644 KiB
6Accepted3/33ms2732 KiB
7Accepted3/33ms2852 KiB
8Accepted3/33ms3064 KiB
9Accepted2/248ms4556 KiB
10Accepted2/248ms4432 KiB
11Accepted2/250ms4680 KiB
12Accepted2/250ms4636 KiB
13Accepted2/250ms4636 KiB
14Accepted2/250ms4924 KiB
15Accepted2/248ms4920 KiB
16Accepted2/248ms4868 KiB
17Accepted2/248ms4784 KiB
18Accepted2/248ms4780 KiB
19Accepted2/248ms5044 KiB
20Accepted2/248ms5108 KiB
21Accepted2/246ms5040 KiB
22Accepted3/348ms5040 KiB
23Accepted3/346ms5072 KiB
24Accepted3/346ms5076 KiB