88122024-01-31 11:53:39GervidZenehallgatáscpp17Time limit exceeded 26/50266ms5320 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];

		auto x = upper_bound(sums.begin(), sums.end(), time);

		cout << x-sums.begin() - ((x-(x != sums.begin())).operator*() == time) + 1 << ' ';
	}
}
SubtaskSumTestVerdictTimeMemory
base26/50
1Accepted0/03ms1808 KiB
2Time limit exceeded0/0201ms1728 KiB
3Accepted2/24ms2380 KiB
4Accepted2/24ms2704 KiB
5Accepted2/24ms2808 KiB
6Accepted3/34ms2932 KiB
7Accepted3/34ms3048 KiB
8Accepted3/34ms3188 KiB
9Time limit exceeded0/2259ms3956 KiB
10Time limit exceeded0/2266ms2860 KiB
11Time limit exceeded0/2218ms4024 KiB
12Time limit exceeded0/2259ms4128 KiB
13Time limit exceeded0/2241ms4352 KiB
14Accepted2/2194ms4376 KiB
15Accepted2/2193ms4352 KiB
16Accepted2/2196ms4312 KiB
17Time limit exceeded0/2245ms4532 KiB
18Time limit exceeded0/2266ms3724 KiB
19Time limit exceeded0/2237ms4860 KiB
20Accepted2/2188ms5124 KiB
21Time limit exceeded0/2228ms5012 KiB
22Time limit exceeded0/3266ms4048 KiB
23Time limit exceeded0/3245ms5232 KiB
24Accepted3/3190ms5320 KiB