1592021-02-03 20:16:35kovacs.peter.18fZenehallgatáscpp11Time limit exceeded 15/50298ms10312 KiB
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

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

	int N, K;
	cin >> N >> K;
	vector<int> lengthS(N);
	int full_length = 0;
	for (auto& e : lengthS) {
		cin >> e;
		full_length += e;
	}
	int song = 0;
	int length = 0;
	for (int i = 0; i < K; i++) {
		int time;
		cin >> time;
		if (length > time) {
			song = 0;
			length = 0;
		}
		while (length + full_length < time) {
			length += full_length;
		}
		while (length < time) {
			song = song % N + 1;
			length += lengthS[song - 1];
		}
		cout << song << " ";
	}
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/02ms1756 KiB
2Time limit exceeded0/0296ms2036 KiB
3Accepted2/26ms2484 KiB
4Accepted2/27ms2508 KiB
5Accepted2/27ms2520 KiB
6Accepted3/38ms2536 KiB
7Accepted3/313ms2548 KiB
8Accepted3/330ms2568 KiB
9Time limit exceeded0/2296ms2688 KiB
10Time limit exceeded0/2296ms3444 KiB
11Time limit exceeded0/2294ms4008 KiB
12Time limit exceeded0/2296ms4628 KiB
13Time limit exceeded0/2282ms5264 KiB
14Time limit exceeded0/2298ms5884 KiB
15Time limit exceeded0/2245ms6508 KiB
16Time limit exceeded0/2284ms7128 KiB
17Time limit exceeded0/2270ms7512 KiB
18Time limit exceeded0/2280ms8012 KiB
19Time limit exceeded0/2259ms8504 KiB
20Time limit exceeded0/2298ms8804 KiB
21Time limit exceeded0/2238ms9224 KiB
22Time limit exceeded0/3206ms9616 KiB
23Time limit exceeded0/3210ms10044 KiB
24Time limit exceeded0/3217ms10312 KiB