150062025-02-11 08:17:43DhaneHaneZenehallgatáscpp17Runtime error 32/50120ms32000 KiB
// zenehalgatas.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

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

int main()
{
    int n, m; cin >> n >> m;
    int h=0;
    vector <int> v(n + 1), mark(m+1);
    for (int i = 1; i <= n; ++i) {
        cin >> v[i];
        h += v[i];
    }
    for (int i = 1; i <= m; ++i) cin >> mark[i];
    vector<int> zsebi(h + 1);
    int ind = 1;
    for (int i = 1; i <= n; ++i) {
        int k = 1;
        while (k <= v[i]) {
            zsebi[ind] = i;
            ++ind;
            ++k;
        }
    }
    for (int i = 1; i <= m; ++i) {
        cout << zsebi[mark[i] % h]<<" ";
    }
}

// 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
base32/50
1Accepted0/01ms316 KiB
2Runtime error0/0101ms32000 KiB
3Accepted2/225ms19864 KiB
4Accepted2/212ms10036 KiB
5Accepted2/24ms2360 KiB
6Accepted3/32ms564 KiB
7Accepted3/32ms316 KiB
8Accepted3/32ms316 KiB
9Runtime error0/2103ms32000 KiB
10Runtime error0/2107ms32000 KiB
11Runtime error0/2100ms32000 KiB
12Runtime error0/2105ms32000 KiB
13Runtime error0/297ms32000 KiB
14Runtime error0/2103ms32000 KiB
15Runtime error0/297ms32000 KiB
16Runtime error0/296ms32000 KiB
17Runtime error0/296ms32000 KiB
18Accepted2/2112ms21420 KiB
19Accepted2/2120ms21420 KiB
20Accepted2/283ms3756 KiB
21Accepted2/282ms3892 KiB
22Accepted3/382ms3892 KiB
23Accepted3/379ms2724 KiB
24Accepted3/381ms2356 KiB