30602023-02-10 10:20:09tamasmarkZenehallgatáscpp17Runtime error 26/5068ms65064 KiB
#include <iostream>
#include <vector>

using namespace std;

struct adat
{
    long long kezd, veg;
};

long long 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/03ms1760 KiB
2Runtime error0/064ms65064 KiB
3Runtime error0/263ms64824 KiB
4Accepted2/227ms35348 KiB
5Accepted2/27ms6900 KiB
6Accepted3/34ms3716 KiB
7Accepted3/33ms3452 KiB
8Accepted3/33ms3208 KiB
9Runtime error0/261ms63720 KiB
10Runtime error0/250ms63520 KiB
11Runtime error0/257ms63428 KiB
12Runtime error0/257ms63404 KiB
13Runtime error0/257ms63256 KiB
14Runtime error0/252ms63140 KiB
15Runtime error0/264ms63156 KiB
16Runtime error0/264ms63144 KiB
17Runtime error0/261ms62908 KiB
18Runtime error0/254ms62696 KiB
19Runtime error0/268ms62700 KiB
20Accepted2/246ms12632 KiB
21Accepted2/243ms12924 KiB
22Accepted3/341ms12872 KiB
23Accepted3/335ms6672 KiB
24Accepted3/335ms6964 KiB