150072025-02-11 08:22:06DhaneHaneZenehallgatáscpp17Futási hiba 26/50104ms32000 KiB
// zenehalgatas.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
#define ll long long
using namespace std;

int main()
{
    ll n, m; cin >> n >> m;
    ll h=0;
    vector <ll> v(n + 1), mark(m+1);
    for (ll i = 1; i <= n; ++i) {
        cin >> v[i];
        h += v[i];
    }
    for (ll i = 1; i <= m; ++i) cin >> mark[i];
    vector<ll> zsebi(h + 1);
    ll ind = 1;
    for (ll i = 1; i <= n; ++i) {
        ll k = 1;
        while (k <= v[i]) {
            zsebi[ind] = i;
            ++ind;
            ++k;
        }
    }
    for (ll 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
base26/50
1Elfogadva0/01ms316 KiB
2Futási hiba0/097ms32000 KiB
3Futási hiba0/234ms32000 KiB
4Elfogadva2/224ms20020 KiB
5Elfogadva2/24ms4148 KiB
6Elfogadva3/32ms564 KiB
7Elfogadva3/32ms792 KiB
8Elfogadva3/32ms316 KiB
9Futási hiba0/2104ms32000 KiB
10Futási hiba0/297ms32000 KiB
11Futási hiba0/2101ms32000 KiB
12Futási hiba0/2101ms32000 KiB
13Futási hiba0/293ms32000 KiB
14Futási hiba0/298ms32000 KiB
15Futási hiba0/298ms32000 KiB
16Futási hiba0/293ms32000 KiB
17Futási hiba0/297ms32000 KiB
18Futási hiba0/296ms32000 KiB
19Futási hiba0/297ms32000 KiB
20Elfogadva2/282ms6844 KiB
21Elfogadva2/285ms6708 KiB
22Elfogadva3/386ms6708 KiB
23Elfogadva3/379ms4284 KiB
24Elfogadva3/379ms3892 KiB