45362023-03-29 13:13:44AblablablaTűzijátékcpp17Accepted 50/5014ms4836 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, s, t;
    cin >> n >> s >> t;

    vector<int> szamok(n, 0);

    for(int i = 0; i < n; i++){
        cin >> szamok[i];
    }

    int valasz = 1;
    vector<int> helyek;
    helyek.push_back(s);

    int elozo = szamok[s - 1];
    for(int i = s - 2; i >= 0; i--){
        if(elozo - szamok[i] >= t){
            valasz++;
            helyek.push_back(i + 1);
            elozo = szamok[i];
            //cout << i << "\n";
        }
        //cout << i << " " << szamok[i] << " " << elozo << "\n";
    }

    //cout << "valtas" << "\n";

    elozo = szamok[s - 1];
    for(int i = s; i < n; i++){
        if(szamok[i] - elozo >= t){
            valasz++;
            helyek.push_back(i + 1);
            elozo = szamok[i];
            //cout << i << "\n";
        }

        //cout << i << " " << szamok[i] << " " << elozo << "\n";
    }

    cout << valasz << "\n";
    sort(helyek.begin(), helyek.end());
    for(int x : helyek){
        cout << x << " ";
    }

    cout << "\n";
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1700 KiB
2Accepted0/014ms2964 KiB
3Accepted2/23ms2072 KiB
4Accepted2/23ms2288 KiB
5Accepted2/23ms2480 KiB
6Accepted2/23ms2692 KiB
7Accepted2/22ms2772 KiB
8Accepted2/23ms2776 KiB
9Accepted2/23ms3168 KiB
10Accepted2/24ms3396 KiB
11Accepted2/24ms3252 KiB
12Accepted2/24ms3468 KiB
13Accepted2/24ms3596 KiB
14Accepted2/24ms3824 KiB
15Accepted3/34ms3820 KiB
16Accepted3/36ms4132 KiB
17Accepted3/38ms4168 KiB
18Accepted3/38ms4164 KiB
19Accepted3/314ms4836 KiB
20Accepted3/314ms4832 KiB
21Accepted4/414ms4836 KiB
22Accepted4/414ms4536 KiB