31342023-02-19 12:31:06horvathabelZenehallgatáscpp17Runtime error 26/5061ms64848 KiB
#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> hp={0};  
	for (int i=0;i<n;i++){ 
		if (i==n-1) hp[0]=i+1; 
		int c;
		cin>>c; 
		for (int j=0; j<c;j++){
			hp.push_back(i+1);
		}
		cnt+=c;
	}
	for (int i=0; i<k;i++){
		int z;
		cin>>z;
		z=z%cnt;
		cout<<hp[z]<<" "; 
	}
}
SubtaskSumTestVerdictTimeMemory
base26/50
1Accepted0/03ms1828 KiB
2Runtime error0/050ms64848 KiB
3Runtime error0/250ms64644 KiB
4Accepted2/225ms35372 KiB
5Accepted2/26ms6628 KiB
6Accepted3/34ms3376 KiB
7Accepted3/33ms3436 KiB
8Accepted3/33ms3120 KiB
9Runtime error0/259ms63932 KiB
10Runtime error0/246ms63924 KiB
11Runtime error0/259ms63688 KiB
12Runtime error0/259ms63524 KiB
13Runtime error0/259ms63432 KiB
14Runtime error0/259ms63232 KiB
15Runtime error0/250ms63012 KiB
16Runtime error0/250ms62916 KiB
17Runtime error0/250ms62776 KiB
18Runtime error0/254ms62768 KiB
19Runtime error0/261ms62776 KiB
20Accepted2/241ms12684 KiB
21Accepted2/241ms12648 KiB
22Accepted3/341ms12924 KiB
23Accepted3/335ms6584 KiB
24Accepted3/335ms6548 KiB