16002022-11-28 20:35:16kicsiboglarTűzijátékcpp11Accepted 50/5043ms5680 KiB
#include <iostream>
#include <vector> 
#include <deque>

#define ll long long 

using namespace std;

ll n, m, k, i, j,last;

int main()
{
    cin >> n >> m >> k;
    vector <ll> x(n + 1);
    for (i = 1; i <= n; ++i) cin >> x[i];

   
    deque <ll> res;
    res.push_back(m);
    for (i = m-1; i >= 1; --i)
    {
        if (x[res[0]] - x[i] >= k) res.push_front(i);
    }

    for (i = m + 1; i <= n; ++i)
    {
        if (x[i] - x[res.back()] >= k) res.push_back(i);
    }
    cout << res.size() << "\n";
    for (auto& e : res) cout << e << " ";
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1808 KiB
2Accepted0/043ms3548 KiB
3Accepted2/22ms2108 KiB
4Accepted2/22ms2312 KiB
5Accepted2/22ms2516 KiB
6Accepted2/22ms2768 KiB
7Accepted2/22ms2972 KiB
8Accepted2/22ms3128 KiB
9Accepted2/24ms3252 KiB
10Accepted2/24ms3544 KiB
11Accepted2/24ms3492 KiB
12Accepted2/28ms3720 KiB
13Accepted2/28ms3672 KiB
14Accepted2/28ms3868 KiB
15Accepted3/38ms4204 KiB
16Accepted3/313ms4276 KiB
17Accepted3/317ms4280 KiB
18Accepted3/321ms5000 KiB
19Accepted3/343ms5676 KiB
20Accepted3/343ms5680 KiB
21Accepted4/443ms5508 KiB
22Accepted4/443ms5508 KiB