92402024-02-19 10:58:12GervidZenehallgatáscpp17Accepted 50/50101ms13116 KiB
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

int main()
{
	iostream::sync_with_stdio(0);
	cin.tie(0);
	int n, k, i, temp, sum = 0;
	cin >> n >> k;

	map<int, int> times;

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

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

		cout << times.lower_bound(temp % sum).operator*().second + 1 << ' ';
	}
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1828 KiB
2Accepted0/0101ms11572 KiB
3Accepted2/23ms2408 KiB
4Accepted2/23ms2628 KiB
5Accepted2/23ms2840 KiB
6Accepted3/33ms3048 KiB
7Accepted3/33ms3260 KiB
8Accepted3/33ms3216 KiB
9Accepted2/2101ms12588 KiB
10Accepted2/2100ms12592 KiB
11Accepted2/2100ms12800 KiB
12Accepted2/2101ms12808 KiB
13Accepted2/298ms12808 KiB
14Accepted2/297ms12892 KiB
15Accepted2/297ms12808 KiB
16Accepted2/297ms12820 KiB
17Accepted2/297ms13112 KiB
18Accepted2/298ms13116 KiB
19Accepted2/298ms13116 KiB
20Accepted2/297ms13028 KiB
21Accepted2/297ms13008 KiB
22Accepted3/397ms13028 KiB
23Accepted3/397ms13116 KiB
24Accepted3/397ms13112 KiB