92372024-02-19 10:52:15GervidZenehallgatáscpp17Time limit exceeded 15/50300ms19432 KiB
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

int main()
{
	int n, k, i, j, temp;
	cin >> n >> k;

	vector<int> sums(n);
	map<int, int> times;
	cin >> sums[0];

	for (i = 1; i < n; i++)
	{
		cin >> temp;
		sums[i] = sums[i - 1] + temp;
	}

	for (i = 0; i < n; i++)
	{
		times[sums[i]] = i;
	}

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

		cout << times.lower_bound(temp % sums[n - 1]).operator*().second + 1 << ' ';
	}
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/03ms1816 KiB
2Time limit exceeded0/0300ms7776 KiB
3Accepted2/26ms3872 KiB
4Accepted2/24ms4000 KiB
5Accepted2/24ms4308 KiB
6Accepted3/34ms4176 KiB
7Accepted3/34ms4444 KiB
8Accepted3/34ms4672 KiB
9Time limit exceeded0/2259ms10404 KiB
10Time limit exceeded0/2247ms17588 KiB
11Time limit exceeded0/2257ms12968 KiB
12Time limit exceeded0/2247ms18400 KiB
13Time limit exceeded0/2282ms13148 KiB
14Time limit exceeded0/2259ms13036 KiB
15Time limit exceeded0/2248ms18792 KiB
16Time limit exceeded0/2250ms13472 KiB
17Time limit exceeded0/2248ms13464 KiB
18Time limit exceeded0/2243ms19080 KiB
19Time limit exceeded0/2261ms13568 KiB
20Time limit exceeded0/2273ms13488 KiB
21Time limit exceeded0/2252ms13488 KiB
22Time limit exceeded0/3236ms19152 KiB
23Time limit exceeded0/3236ms19284 KiB
24Time limit exceeded0/3240ms19432 KiB