31332023-02-19 12:26:53horvathabelZenehallgatáscpp17Runtime error 19/50270ms64844 KiB
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n,k; 
	cin>>n>>k;
	int cnt=0;
	vector<int> hp={0};  
	for (int i=0;i<n;i++){
		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;
		if (z!=cnt) z=z%cnt;
		cout<<hp[z]<<" "; 
	}
}
SubtaskSumTestVerdictTimeMemory
base19/50
1Accepted0/03ms1816 KiB
2Runtime error0/048ms64844 KiB
3Runtime error0/250ms64736 KiB
4Accepted2/228ms35024 KiB
5Accepted2/28ms6448 KiB
6Accepted3/36ms3188 KiB
7Accepted3/34ms2952 KiB
8Accepted3/34ms2964 KiB
9Runtime error0/248ms64072 KiB
10Runtime error0/248ms63840 KiB
11Runtime error0/259ms63808 KiB
12Runtime error0/250ms63568 KiB
13Runtime error0/250ms63564 KiB
14Runtime error0/263ms63320 KiB
15Runtime error0/252ms63088 KiB
16Runtime error0/254ms63084 KiB
17Runtime error0/252ms63072 KiB
18Runtime error0/264ms63056 KiB
19Runtime error0/264ms63040 KiB
20Time limit exceeded0/2217ms12388 KiB
21Time limit exceeded0/2250ms12232 KiB
22Time limit exceeded0/3270ms7556 KiB
23Accepted3/3174ms6072 KiB
24Accepted3/3173ms6104 KiB