81982024-01-12 18:14:09GervidZenehallgatáscpp17Time limit exceeded 15/50300ms4424 KiB
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <limits.h>
#include <algorithm>
#include <math.h>

using namespace std;

int main()
{
	int n, k, i, j, sum = 0, time;
	cin >> n >> k;

	vector<int> songs(n);

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

	for (i = 0; i < k; i++)
	{
		cin >> time;

		time %= sum;

		j = 0;
		while (time > 0)
		{
			time -= songs[j];
			j++;
		}
		cout << j << ' ';
	}
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/03ms1812 KiB
2Time limit exceeded0/0300ms1600 KiB
3Accepted2/26ms2500 KiB
4Accepted2/24ms2440 KiB
5Accepted2/24ms2512 KiB
6Accepted3/34ms2732 KiB
7Accepted3/34ms2936 KiB
8Accepted3/34ms3028 KiB
9Time limit exceeded0/2300ms2792 KiB
10Time limit exceeded0/2263ms2900 KiB
11Time limit exceeded0/2254ms2704 KiB
12Time limit exceeded0/2300ms2836 KiB
13Time limit exceeded0/2275ms2988 KiB
14Time limit exceeded0/2246ms3220 KiB
15Time limit exceeded0/2266ms3352 KiB
16Time limit exceeded0/2270ms3516 KiB
17Time limit exceeded0/2270ms3656 KiB
18Time limit exceeded0/2266ms3900 KiB
19Time limit exceeded0/2261ms4020 KiB
20Time limit exceeded0/2237ms4168 KiB
21Time limit exceeded0/2266ms4196 KiB
22Time limit exceeded0/3246ms4264 KiB
23Time limit exceeded0/3252ms4348 KiB
24Time limit exceeded0/3252ms4424 KiB