150072025-02-11 08:22:06DhaneHaneZenehallgatáscpp17Runtime error 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
SubtaskSumTestVerdictTimeMemory
base26/50
1Accepted0/01ms316 KiB
2Runtime error0/097ms32000 KiB
3Runtime error0/234ms32000 KiB
4Accepted2/224ms20020 KiB
5Accepted2/24ms4148 KiB
6Accepted3/32ms564 KiB
7Accepted3/32ms792 KiB
8Accepted3/32ms316 KiB
9Runtime error0/2104ms32000 KiB
10Runtime error0/297ms32000 KiB
11Runtime error0/2101ms32000 KiB
12Runtime error0/2101ms32000 KiB
13Runtime error0/293ms32000 KiB
14Runtime error0/298ms32000 KiB
15Runtime error0/298ms32000 KiB
16Runtime error0/293ms32000 KiB
17Runtime error0/297ms32000 KiB
18Runtime error0/296ms32000 KiB
19Runtime error0/297ms32000 KiB
20Accepted2/282ms6844 KiB
21Accepted2/285ms6708 KiB
22Accepted3/386ms6708 KiB
23Accepted3/379ms4284 KiB
24Accepted3/379ms3892 KiB