82022024-01-12 18:28:01GervidZenehallgatáscpp17Time limit exceeded 15/50277ms13712 KiB
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <limits.h>
#include <algorithm>
#include <math.h>

using namespace std;

int main()
{
	int n, k, i, j, sum = 0, time, song;
	cin >> n >> k;

	map<int, int> songs;

	for (i = 0; i < n; i++)
	{
		cin >> song;
		sum += song;

		songs[sum] = i;
	}

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

		time = (time - 1) % sum + 1;

		cout << songs.upper_bound(time-1).operator*().second + 1 << ' ';
	}
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/03ms1960 KiB
2Time limit exceeded0/0263ms6044 KiB
3Accepted2/24ms2476 KiB
4Accepted2/24ms2348 KiB
5Accepted2/24ms2608 KiB
6Accepted3/34ms2936 KiB
7Accepted3/34ms3156 KiB
8Accepted3/34ms2988 KiB
9Time limit exceeded0/2243ms12236 KiB
10Time limit exceeded0/2239ms12508 KiB
11Time limit exceeded0/2254ms7244 KiB
12Time limit exceeded0/2275ms7192 KiB
13Time limit exceeded0/2275ms7256 KiB
14Time limit exceeded0/2266ms7336 KiB
15Time limit exceeded0/2250ms7644 KiB
16Time limit exceeded0/2263ms7492 KiB
17Time limit exceeded0/2259ms7520 KiB
18Time limit exceeded0/2246ms13132 KiB
19Time limit exceeded0/2254ms8024 KiB
20Time limit exceeded0/2256ms13624 KiB
21Time limit exceeded0/2256ms13712 KiB
22Time limit exceeded0/3277ms8256 KiB
23Time limit exceeded0/3254ms8412 KiB
24Time limit exceeded0/3257ms8428 KiB