30622023-02-10 10:24:09tamasmarkZenehallgatáscpp17Wrong answer 26/5068ms64912 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.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())
        {
            a = a % h;
            cout << x[a] << " ";
        }
        else
        {
            cout << x[a] << " ";
        }
    }
    return 0;
}
/*
3 2
2 4 3
6 30
*/
SubtaskSumTestVerdictTimeMemory
base26/50
1Wrong answer0/03ms1892 KiB
2Runtime error0/064ms64912 KiB
3Runtime error0/261ms64672 KiB
4Accepted2/232ms35500 KiB
5Accepted2/27ms7008 KiB
6Accepted3/33ms3540 KiB
7Accepted3/33ms3372 KiB
8Accepted3/33ms3380 KiB
9Runtime error0/257ms63804 KiB
10Runtime error0/261ms63696 KiB
11Runtime error0/261ms63456 KiB
12Runtime error0/250ms63216 KiB
13Runtime error0/261ms63212 KiB
14Runtime error0/250ms63180 KiB
15Runtime error0/261ms62948 KiB
16Runtime error0/263ms62704 KiB
17Runtime error0/264ms62704 KiB
18Runtime error0/268ms62688 KiB
19Runtime error0/267ms62692 KiB
20Accepted2/246ms12656 KiB
21Accepted2/243ms12692 KiB
22Accepted3/341ms12668 KiB
23Accepted3/335ms6740 KiB
24Accepted3/335ms6628 KiB