85732024-01-22 11:43:25csaron71Tűzijátékcpp17Accepted 50/5050ms10248 KiB
#include <bits/stdc++.h>

using namespace std;



int main()
{
    int n, s, t;
    cin >> n >> s >> t;
    s--;
    vector<int> telepulesek(n);
    for (int i=0; i<n; i++) {
        cin  >> telepulesek[i];
    }

    vector<int> vege;
    vege.push_back(s);
    int jobb=telepulesek[s];
    for (int i=s+1; i<n; i++) {
        if (jobb+t<=telepulesek[i]) {
            vege.push_back(i);
            jobb=telepulesek[i];
        }
    }

    int bal=telepulesek[s];
    for (int i=s-1; i>=0; i--) {
        if (bal>=telepulesek[i]+t) {
            vege.push_back(i);
            bal=telepulesek[i];
        }
    }

    cout << vege.size() << "\n";
    sort(vege.begin(), vege.end());
    for (int sz : vege) {
        cout << sz+1 << " ";
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1976 KiB
2Accepted0/048ms3868 KiB
3Accepted2/23ms2924 KiB
4Accepted2/23ms3056 KiB
5Accepted2/23ms3268 KiB
6Accepted2/23ms3408 KiB
7Accepted2/23ms3500 KiB
8Accepted2/23ms3628 KiB
9Accepted2/24ms3876 KiB
10Accepted2/26ms4084 KiB
11Accepted2/27ms4168 KiB
12Accepted2/29ms4364 KiB
13Accepted2/29ms4456 KiB
14Accepted2/29ms4612 KiB
15Accepted3/39ms4732 KiB
16Accepted3/314ms5048 KiB
17Accepted3/318ms5452 KiB
18Accepted3/323ms6272 KiB
19Accepted3/350ms7608 KiB
20Accepted3/348ms8428 KiB
21Accepted4/448ms9492 KiB
22Accepted4/448ms10248 KiB