150062025-02-11 08:17:43DhaneHaneZenehallgatáscpp17Futási hiba 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
RészfeladatÖsszpontTesztVerdiktIdőMemória
base32/50
1Elfogadva0/01ms316 KiB
2Futási hiba0/0101ms32000 KiB
3Elfogadva2/225ms19864 KiB
4Elfogadva2/212ms10036 KiB
5Elfogadva2/24ms2360 KiB
6Elfogadva3/32ms564 KiB
7Elfogadva3/32ms316 KiB
8Elfogadva3/32ms316 KiB
9Futási hiba0/2103ms32000 KiB
10Futási hiba0/2107ms32000 KiB
11Futási hiba0/2100ms32000 KiB
12Futási hiba0/2105ms32000 KiB
13Futási hiba0/297ms32000 KiB
14Futási hiba0/2103ms32000 KiB
15Futási hiba0/297ms32000 KiB
16Futási hiba0/296ms32000 KiB
17Futási hiba0/296ms32000 KiB
18Elfogadva2/2112ms21420 KiB
19Elfogadva2/2120ms21420 KiB
20Elfogadva2/283ms3756 KiB
21Elfogadva2/282ms3892 KiB
22Elfogadva3/382ms3892 KiB
23Elfogadva3/379ms2724 KiB
24Elfogadva3/381ms2356 KiB