216372026-01-13 17:35:14PappMatyasZenehallgatáscpp17Time limit exceeded 0/50300ms832 KiB
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int n, m, total = 0;
	cin >> n >> m;
	vector<int> v(n);
	for (int i = 0; i < n; i++)
	{
		cin >> v[i];
		total += v[i];
		if (i != 0)
		{
			v[i] += v[i - 1];
		}
	}
	for (int i = 0; i < m; i++)
	{
		int x;
		cin >> x;
		x = x % total;
		if (x == 0)
		{
			x = total;
		}
		int j = n - 1;
		while (x < v[j] && j > 0)
		{
			j--;
		}
		cout << j + 1 << " ";
	}
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Accepted0/01ms316 KiB
2Time limit exceeded0/0277ms812 KiB
3Wrong answer0/24ms316 KiB
4Wrong answer0/24ms316 KiB
5Wrong answer0/24ms508 KiB
6Wrong answer0/34ms316 KiB
7Wrong answer0/34ms560 KiB
8Wrong answer0/34ms316 KiB
9Time limit exceeded0/2300ms812 KiB
10Time limit exceeded0/2300ms804 KiB
11Time limit exceeded0/2300ms804 KiB
12Time limit exceeded0/2282ms820 KiB
13Time limit exceeded0/2289ms820 KiB
14Time limit exceeded0/2289ms820 KiB
15Time limit exceeded0/2300ms808 KiB
16Time limit exceeded0/2284ms820 KiB
17Time limit exceeded0/2287ms820 KiB
18Time limit exceeded0/2287ms816 KiB
19Time limit exceeded0/2300ms808 KiB
20Time limit exceeded0/2284ms820 KiB
21Time limit exceeded0/2287ms816 KiB
22Time limit exceeded0/3287ms832 KiB
23Time limit exceeded0/3300ms812 KiB
24Time limit exceeded0/3289ms820 KiB