30612023-02-10 10:21:03tamasmarkZenehallgatáscpp17Runtime error 26/5068ms64908 KiB
#include <iostream>
#include <vector>

using namespace std;

int n, k, i, a, b, j, h;
vector <int> x;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> k;
    h = 0;
    //x.resize(LLONG_MAX + 1);
    x.push_back(0);
    for (i = 1; i <= n; ++i)
    {
        cin >> a;
        for (j = 1; j <= a; ++j)
        {
            x.push_back(i);
        }
        h = h + a;
    }
    x.resize(h + 1);
    for (i = 1; i <= k; ++i)
    {
        cin >> a;
        if (a > x.size()-1)
        {
            a = a % h;
            cout << x[a] << " ";
        }
        else
        {
            cout << x[a] << " ";
        }
    }
    return 0;
}
/*
3 2
2 4 3
6 30
*/
SubtaskSumTestVerdictTimeMemory
base26/50
1Accepted0/03ms1892 KiB
2Runtime error0/064ms64908 KiB
3Runtime error0/263ms64668 KiB
4Accepted2/227ms35772 KiB
5Accepted2/26ms7096 KiB
6Accepted3/33ms3756 KiB
7Accepted3/33ms3680 KiB
8Accepted3/33ms3364 KiB
9Runtime error0/250ms63640 KiB
10Runtime error0/261ms63620 KiB
11Runtime error0/257ms63376 KiB
12Runtime error0/257ms63144 KiB
13Runtime error0/261ms63124 KiB
14Runtime error0/252ms63096 KiB
15Runtime error0/261ms63080 KiB
16Runtime error0/252ms63056 KiB
17Runtime error0/264ms63044 KiB
18Runtime error0/257ms62820 KiB
19Runtime error0/268ms62720 KiB
20Accepted2/245ms12608 KiB
21Accepted2/243ms12608 KiB
22Accepted3/343ms12864 KiB
23Accepted3/334ms6600 KiB
24Accepted3/334ms6588 KiB