31352023-02-19 12:43:16horvathabelZenehallgatáscpp17Accepted 50/5050ms5224 KiB
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,k; 
	cin>>n>>k;
	int cnt=0;
	vector<int> hatarok={0}; 
	for (int i=1;i<=n;i++){ 
		int c;
		cin>>c; 
		
		hatarok.push_back(c+hatarok[i-1]);
		cnt+=c;
	}
	for (int i=0; i<k;i++){
		int z;
		cin>>z;
		z=z%cnt;
		if (z==0) z+=cnt;
		cout<<lower_bound(hatarok.begin(), hatarok.end(),z)-hatarok.begin()<<" "; 


		
	}
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1700 KiB
2Accepted0/050ms3196 KiB
3Accepted2/23ms2204 KiB
4Accepted2/23ms2224 KiB
5Accepted2/23ms2220 KiB
6Accepted3/33ms2436 KiB
7Accepted3/33ms2784 KiB
8Accepted3/33ms2688 KiB
9Accepted2/250ms4024 KiB
10Accepted2/250ms4264 KiB
11Accepted2/250ms4476 KiB
12Accepted2/250ms4492 KiB
13Accepted2/250ms4428 KiB
14Accepted2/250ms4432 KiB
15Accepted2/250ms4432 KiB
16Accepted2/250ms4484 KiB
17Accepted2/250ms4820 KiB
18Accepted2/248ms4896 KiB
19Accepted2/248ms5040 KiB
20Accepted2/248ms4972 KiB
21Accepted2/248ms4968 KiB
22Accepted3/348ms5224 KiB
23Accepted3/348ms5180 KiB
24Accepted3/348ms5176 KiB