88112024-01-31 11:48:02GervidZenehallgatáscpp17Time limit exceeded 15/50282ms27084 KiB
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

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

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

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

		time %= sums[n - 1];;

		cout << upper_bound(sums.begin(), sums.end(), time)-sums.begin() + 1 - ((upper_bound(sums.begin(), sums.end(), time)-(upper_bound(sums.begin(), sums.end(), time) != sums.begin())).operator*() == time) << ' ';
	}
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/03ms1936 KiB
2Time limit exceeded0/0282ms4384 KiB
3Accepted2/24ms3816 KiB
4Accepted2/26ms3940 KiB
5Accepted2/24ms4236 KiB
6Accepted3/34ms4428 KiB
7Accepted3/34ms4436 KiB
8Accepted3/34ms4460 KiB
9Time limit exceeded0/2275ms5804 KiB
10Time limit exceeded0/2226ms8556 KiB
11Time limit exceeded0/2224ms9856 KiB
12Time limit exceeded0/2224ms11368 KiB
13Time limit exceeded0/2221ms12808 KiB
14Time limit exceeded0/2217ms14320 KiB
15Time limit exceeded0/2219ms15692 KiB
16Time limit exceeded0/2264ms15900 KiB
17Time limit exceeded0/2218ms18368 KiB
18Time limit exceeded0/2223ms18588 KiB
19Time limit exceeded0/2266ms19780 KiB
20Time limit exceeded0/2275ms22060 KiB
21Time limit exceeded0/2273ms22528 KiB
22Time limit exceeded0/3277ms24736 KiB
23Time limit exceeded0/3257ms24868 KiB
24Time limit exceeded0/3241ms27084 KiB