42982023-03-22 14:37:40horvathabelTűzijátékcpp17Accepted 50/5046ms6664 KiB
#include <bits/stdc++.h>
using namespace std;
using ll=long long; 
int main() {
	int n,k,s;
	cin>>n>>k>>s;
	vector<ll> tav={-50000001};
	for (int i=0; i<n;i++){
		ll c;
		cin>>c;
		tav.push_back(c);
	}
	vector<int> ans={k}; 
	int mst=tav[k];
	for (int i=k-1;i>0;i--){
		if (tav[i]+s<=mst){
			mst=tav[i];
			ans.push_back(i);
		}
	}
	mst=tav[k];
	for (int i=k+1; i<=n;i++){
		if (tav[i]-s>=mst){
			mst=tav[i];
			ans.push_back(i);
		}
	}
	sort(ans.begin(), ans.end());
	cout<<ans.size()<<endl;
	for (int x:ans) cout<<x<<" "; 
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1812 KiB
2Accepted0/043ms4028 KiB
3Accepted2/23ms2336 KiB
4Accepted2/23ms2548 KiB
5Accepted2/23ms2648 KiB
6Accepted2/22ms2852 KiB
7Accepted2/23ms3064 KiB
8Accepted2/23ms3184 KiB
9Accepted2/24ms3540 KiB
10Accepted2/26ms3940 KiB
11Accepted2/26ms4120 KiB
12Accepted2/28ms4600 KiB
13Accepted2/29ms4808 KiB
14Accepted2/28ms4820 KiB
15Accepted3/38ms4816 KiB
16Accepted3/314ms4916 KiB
17Accepted3/317ms5556 KiB
18Accepted3/320ms5548 KiB
19Accepted3/345ms6524 KiB
20Accepted3/343ms6664 KiB
21Accepted4/446ms6600 KiB
22Accepted4/443ms6592 KiB