11292022-03-12 10:50:37kovacs.peter.18fTűzijátékcpp11Accepted 50/5017ms8120 KiB
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

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

	int N, S, T;
	cin >> N >> S >> T;
	vector<int> distanceS(N);
	for (auto &e : distanceS) {
		cin >> e;
	}
	vector<int> answerS{ S - 1 };
	int last = distanceS[S - 1];
	for (int i = S - 2; i >= 0; i--) {
		if (last - distanceS[i] >= T) {
			answerS.push_back(i);
			last = distanceS[i];
		}
	}
	last = distanceS[S - 1];
	for (int i = S; i < N; i++) {
		if (distanceS[i] - last >= T) {
			answerS.push_back(i);
			last = distanceS[i];
		}
	}
	sort(answerS.begin(), answerS.end());
	cout << answerS.size() << '\n';
	for (auto e : answerS) {
		cout << e + 1 << " ";
	}
	cout << '\n';
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1760 KiB
2Accepted0/017ms3660 KiB
3Accepted2/21ms2660 KiB
4Accepted2/21ms2664 KiB
5Accepted2/22ms2664 KiB
6Accepted2/22ms2672 KiB
7Accepted2/21ms2672 KiB
8Accepted2/21ms2680 KiB
9Accepted2/22ms2724 KiB
10Accepted2/24ms2776 KiB
11Accepted2/23ms2960 KiB
12Accepted2/24ms3072 KiB
13Accepted2/23ms3320 KiB
14Accepted2/23ms3312 KiB
15Accepted3/33ms3444 KiB
16Accepted3/34ms3880 KiB
17Accepted3/36ms4116 KiB
18Accepted3/37ms4536 KiB
19Accepted3/314ms6044 KiB
20Accepted3/314ms6800 KiB
21Accepted4/413ms7608 KiB
22Accepted4/413ms8120 KiB