117032024-11-06 16:19:35MCDaveZenehallgatáscpp17Runtime error 11/5032ms32000 KiB
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int n, k, i, j, sum=0, question, temp1;
    cin >> n >> k;
    vector<int> playlist(n*1000);

    for (i = 0; i < n; i++)
    {
        cin >> temp1;
        for (j = sum; j < temp1+sum; j++)
        {
            playlist[j] = i;
        }
        sum += temp1;
    }
    

    for (i = 0; i < k; i++)
    {
        cin >> question;
        question %= sum;
        question--;
        cout << playlist[question]+1 << ' ';
    }
}

//5 4
//21 31 41 51 10
//21 22 52 53
SubtaskSumTestVerdictTimeMemory
base11/50
1Accepted0/01ms320 KiB
2Runtime error0/027ms32000 KiB
3Runtime error0/26ms4152 KiB
4Runtime error0/26ms4164 KiB
5Accepted2/26ms4152 KiB
6Accepted3/37ms4284 KiB
7Accepted3/36ms4152 KiB
8Accepted3/36ms4156 KiB
9Runtime error0/232ms32000 KiB
10Runtime error0/226ms32000 KiB
11Runtime error0/227ms32000 KiB
12Runtime error0/227ms32000 KiB
13Runtime error0/227ms32000 KiB
14Runtime error0/227ms32000 KiB
15Runtime error0/232ms32000 KiB
16Runtime error0/232ms32000 KiB
17Runtime error0/227ms32000 KiB
18Runtime error0/227ms32000 KiB
19Runtime error0/232ms32000 KiB
20Runtime error0/227ms32000 KiB
21Runtime error0/226ms32000 KiB
22Runtime error0/332ms32000 KiB
23Runtime error0/332ms32000 KiB
24Runtime error0/330ms32000 KiB