162672025-04-17 21:33:34DhaneHaneZenehallgatáscpp17Accepted 50/5052ms1788 KiB
// zene.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n, k, a; cin >> n >> k;
    vector <long long> summa(n+1,0);
    for (int i = 1; i <= n; ++i) {
        cin >> a;
        summa[i]= summa[i-1] + a;
    }
    long long teljes = summa[n];
    while(k--) {
        long long time;
        cin >> time;
        time %= teljes;
        int index = lower_bound(summa.begin(), summa.end(), time) - summa.begin();
        cout << index<< " ";
    }
    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/01ms316 KiB
2Accepted0/050ms1612 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms316 KiB
5Accepted2/21ms316 KiB
6Accepted3/31ms316 KiB
7Accepted3/31ms316 KiB
8Accepted3/31ms316 KiB
9Accepted2/252ms1736 KiB
10Accepted2/250ms1672 KiB
11Accepted2/252ms1588 KiB
12Accepted2/250ms1588 KiB
13Accepted2/250ms1588 KiB
14Accepted2/250ms1740 KiB
15Accepted2/250ms1584 KiB
16Accepted2/250ms1588 KiB
17Accepted2/250ms1560 KiB
18Accepted2/250ms1728 KiB
19Accepted2/250ms1732 KiB
20Accepted2/248ms1776 KiB
21Accepted2/248ms1592 KiB
22Accepted3/348ms1756 KiB
23Accepted3/348ms1788 KiB
24Accepted3/348ms1588 KiB