45192023-03-29 12:11:52EyusieTűzijátékcpp17Accepted 50/5017ms6532 KiB
#include <bits/stdc++.h>

using namespace std;

int n, telh, tav;
vector<int> kapcs;
vector<int> varos;



int main()
{
    iostream::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> telh >> tav;
    kapcs.assign(n, 100001);
    int ertek;
    int counter = 0;
    for(int i = 0; i < n; i++)
    {
        cin >> ertek;
        varos.push_back(ertek);
    }
    set<int> varosok;
    int current = telh-1;
    for(int i = telh-2; i >= 0; i--)
    {
        if(varos[current] - varos[i] >= tav)
        {
            varosok.insert(i+1);
            counter++;
            current = i;
        }
    }
    current = telh-1;
    for(int i = telh; i < varos.size(); i++)
    {
        if(varos[i] - varos[current] >= tav)
        {
            varosok.insert(i+1);
            counter++;
            current = i;
        }
    }
        varosok.insert(telh);
        cout << varosok.size() << "\n";
        for(set<int>::iterator itr = varosok.begin(); itr != varosok.end(); ++itr)
        {
            cout << *itr << " ";
        }
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1832 KiB
2Accepted0/017ms4344 KiB
3Accepted2/22ms2136 KiB
4Accepted2/22ms2140 KiB
5Accepted2/23ms2264 KiB
6Accepted2/22ms2368 KiB
7Accepted2/23ms2488 KiB
8Accepted2/23ms3004 KiB
9Accepted2/23ms3112 KiB
10Accepted2/24ms3520 KiB
11Accepted2/24ms3460 KiB
12Accepted2/24ms3936 KiB
13Accepted2/24ms3880 KiB
14Accepted2/24ms3940 KiB
15Accepted3/34ms4000 KiB
16Accepted3/37ms4388 KiB
17Accepted3/38ms4760 KiB
18Accepted3/38ms5244 KiB
19Accepted3/317ms6532 KiB
20Accepted3/317ms6404 KiB
21Accepted4/417ms6496 KiB
22Accepted4/414ms6116 KiB