106872024-04-08 22:53:13VargusTűzijátékcpp17Accepted 50/5048ms11716 KiB
#include <iostream>
#include <queue>
#include <set>
#define ll long long

using namespace std;

int main()
{
    ll n, p, t;
    cin >> n >> p >> t;
    vector <ll> x(n + 1);
    set <ll> poz;
    for (ll i = 1; i <= n; ++i)
    {
        cin >> x[i];
    }
    poz.insert(p);
    ll a = x[p], db = 1;
    for (ll i = p - 1; i >= 1; --i)
    {
        if (a - x[i] >= t)
        {
            a = x[i];
            poz.insert(i);
            ++db;
        }
    }
    a = x[p];
    for (ll i = p + 1; i <= n; ++i)
    {
        if (x[i] - a >= t)
        {
            a = x[i];
            poz.insert(i);
            ++db;
        }
    }
    cout << db << "\n";
    for (auto& e : poz)
        cout << e << " ";

    return 0;
}
/*
6 4 100
0 70 110 210 230 500
*/
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1816 KiB
2Accepted0/046ms5292 KiB
3Accepted2/23ms3048 KiB
4Accepted2/23ms3168 KiB
5Accepted2/23ms3368 KiB
6Accepted2/23ms3732 KiB
7Accepted2/23ms3768 KiB
8Accepted2/23ms3812 KiB
9Accepted2/24ms4256 KiB
10Accepted2/26ms4664 KiB
11Accepted2/26ms4944 KiB
12Accepted2/29ms5332 KiB
13Accepted2/29ms5684 KiB
14Accepted2/28ms5820 KiB
15Accepted3/39ms6192 KiB
16Accepted3/314ms6820 KiB
17Accepted3/318ms7296 KiB
18Accepted3/323ms8016 KiB
19Accepted3/348ms10040 KiB
20Accepted3/346ms11036 KiB
21Accepted4/446ms11716 KiB
22Accepted4/446ms11636 KiB