1702021-02-03 21:46:23Babják PéterZenehallgatáscpp11Wrong answer 0/50296ms7008 KiB
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

struct time_ {
	int second;
	int index;
	int song;
};

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

	int N, K;
	cin >> N >> K;
	vector<int> songS(N);
	int full_time = 0;
	for (auto& e : songS) {
		cin >> e;
		full_time += e;
	}
	vector<time_> timeS(K);
	for (int i = 0; i < K; i++) {
		cin >> timeS[i].second;
		timeS[i].index = i;
	}
	sort(timeS.begin(), timeS.end(), [](time_ a, time_ b) {
		return a.second < b.second;
	});
	int song = 0;
	long long length = songS[0];
	for (auto& e : timeS) {
		while (e.second > length) {
			song = (song == N - 1 ? 0 : song + 1);
			length += songS[song];
		}
		e.song = song + 1;
	}
	for (auto e : timeS) {
		cout << e.song << " ";
	}
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Accepted0/02ms1752 KiB
2Accepted0/043ms5740 KiB
3Wrong answer0/22ms2772 KiB
4Wrong answer0/22ms2772 KiB
5Wrong answer0/23ms2772 KiB
6Wrong answer0/316ms2776 KiB
7Wrong answer0/328ms2772 KiB
8Wrong answer0/3127ms2808 KiB
9Wrong answer0/243ms5808 KiB
10Wrong answer0/241ms6364 KiB
11Wrong answer0/243ms6812 KiB
12Wrong answer0/243ms7000 KiB
13Wrong answer0/243ms6984 KiB
14Wrong answer0/243ms6992 KiB
15Wrong answer0/246ms7008 KiB
16Wrong answer0/246ms7004 KiB
17Wrong answer0/246ms7000 KiB
18Wrong answer0/252ms6996 KiB
19Wrong answer0/250ms6996 KiB
20Wrong answer0/2172ms6996 KiB
21Wrong answer0/2160ms7000 KiB
22Wrong answer0/3165ms6996 KiB
23Time limit exceeded0/3296ms4672 KiB
24Time limit exceeded0/3291ms4724 KiB