117012024-11-06 15:29:05MCDaveZenehallgatáscpp17Time limit exceeded 0/50300ms1080 KiB
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int n, k, i, j, sum=0, question, copy, look;
    cin >> n >> k;
    vector<int> playlist(n);
    vector<pair<int, int>> key(4);
    key[0] = { 0, 0 };

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

    for (i = 1; i < 4; i++)
    {
        copy = (sum / 4)*i;
        for (j = 0; j < n and copy > 0; j++)
        {
            copy -= playlist[j];
        }
        key[i] = { j, copy };
    }

    for (i = 0; i < k; i++)
    {
        cin >> question;
        question %= sum;
        look = question / (sum / 4);
        question %= sum / 4;
        question += key[look].second * -1;

        for (j = 0; j < n and question > 0; j++)
        {
            question -= playlist[j+key[look].first];
        }

        cout << j+key[look].first << ' ';
    }
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Accepted0/01ms508 KiB
2Time limit exceeded0/0277ms824 KiB
3Wrong answer0/23ms500 KiB
4Wrong answer0/24ms320 KiB
5Wrong answer0/23ms320 KiB
6Wrong answer0/33ms320 KiB
7Wrong answer0/33ms320 KiB
8Wrong answer0/33ms320 KiB
9Time limit exceeded0/2300ms1060 KiB
10Time limit exceeded0/2300ms1064 KiB
11Time limit exceeded0/2300ms1080 KiB
12Time limit exceeded0/2284ms1080 KiB
13Time limit exceeded0/2293ms824 KiB
14Time limit exceeded0/2293ms824 KiB
15Time limit exceeded0/2300ms1080 KiB
16Time limit exceeded0/2280ms1080 KiB
17Time limit exceeded0/2286ms824 KiB
18Time limit exceeded0/2287ms1080 KiB
19Time limit exceeded0/2300ms1060 KiB
20Time limit exceeded0/2280ms1080 KiB
21Time limit exceeded0/2298ms1080 KiB
22Time limit exceeded0/3300ms1064 KiB
23Runtime error0/329ms824 KiB
24Time limit exceeded0/3286ms1080 KiB