2132021-02-07 23:04:24kovacs.peter.18fZenehallgatáscpp11Accepted 50/5057ms5112 KiB
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	cin.sync_with_stdio(false);
	cin.tie(nullptr);

	int N, K;
	cin >> N >> K;
	vector<int> songS(N);
	cin >> songS[0];
	for (int i = 1; i < N; i++) {
		cin >> songS[i];
		songS[i] += songS[i - 1];
	}
	for (int i = 0; i < K; i++) {
		int k;
		cin >> k;
		cout << lower_bound(songS.begin(), songS.end(), k % songS[N - 1]) - songS.begin() + 1 << " ";
	}
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1752 KiB
2Accepted0/048ms4060 KiB
3Accepted2/22ms3308 KiB
4Accepted2/21ms3320 KiB
5Accepted2/21ms3336 KiB
6Accepted3/32ms3352 KiB
7Accepted3/32ms3368 KiB
8Accepted3/32ms3384 KiB
9Accepted2/250ms4196 KiB
10Accepted2/257ms4192 KiB
11Accepted2/250ms4600 KiB
12Accepted2/248ms4620 KiB
13Accepted2/246ms4632 KiB
14Accepted2/248ms4600 KiB
15Accepted2/246ms4584 KiB
16Accepted2/246ms4600 KiB
17Accepted2/246ms4596 KiB
18Accepted2/245ms4608 KiB
19Accepted2/245ms4696 KiB
20Accepted2/245ms4772 KiB
21Accepted2/248ms4856 KiB
22Accepted3/346ms4936 KiB
23Accepted3/346ms5040 KiB
24Accepted3/346ms5112 KiB