89902024-02-10 21:28:46xxxTűzijátékcpp17Accepted 50/5050ms10612 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
	int n, s, t;
	cin >> n >> s >> t;
	vector<int> v(n+1);
	for(int i = 1; i <= n; i++) {
		cin >> v[i];
	}

	vector<int> ans;
	ans.push_back(s);
	int now = v[s];

	for(int i = s+1; i <= n; i++) {
		if (v[i] - now >= t) {
			now = v[i];
			ans.push_back(i);
		}
	}
	now = v[s];
	for(int i = s-1; i > 0; i--) {
		if (now - v[i] >= t) {
			now = v[i];
			ans.push_back(i);
		}
	}
	cout << ans.size() << '\n';
	sort(ans.begin(), ans.end());
	for(auto i : ans) cout << i << ' ';
	
	return 0;
	
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1812 KiB
2Accepted0/048ms4796 KiB
3Accepted2/23ms2940 KiB
4Accepted2/22ms2996 KiB
5Accepted2/23ms3244 KiB
6Accepted2/23ms3480 KiB
7Accepted2/22ms3480 KiB
8Accepted2/23ms3372 KiB
9Accepted2/24ms3792 KiB
10Accepted2/26ms3940 KiB
11Accepted2/26ms4064 KiB
12Accepted2/29ms4124 KiB
13Accepted2/29ms4252 KiB
14Accepted2/29ms4660 KiB
15Accepted3/39ms4640 KiB
16Accepted3/314ms5232 KiB
17Accepted3/319ms5792 KiB
18Accepted3/324ms6500 KiB
19Accepted3/350ms8404 KiB
20Accepted3/348ms9160 KiB
21Accepted4/448ms10088 KiB
22Accepted4/448ms10612 KiB