201782026-01-03 21:16:25szabelrTűzijátékcpp17Elfogadva 50/5014ms1716 KiB
 // Tűzijáték.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, s, t;
    cin >> n >> s >> t;
    vector<int> sor(n + 1);
    for (int i = 1; i <= n; i++)
    {
        int x;
        cin >> x;
        sor[i] = x;
    }
    int i = s;
    int most = sor[i];
    vector<int>res;
    while (i <= n)
    {
        if (sor[i] - t >= most)
        {
            most = sor[i];
            res.push_back(i);
        }
        i++;
    }
    i = s ;
    most = sor[i];
    while (i > 0)
    {
        if (sor[i] + t <= most)
        {
            most = sor[i];
            res.push_back(i);
        }
        i--;
    }
    res.push_back(s);
    sort(res.begin(), res.end());
    cout << res.size() << endl;
    for (auto x : res)
        cout << x << " ";
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
RészfeladatÖsszpontTesztVerdiktIdőMemória
base50/50
1Elfogadva0/01ms508 KiB
2Elfogadva0/014ms1080 KiB
3Elfogadva2/21ms316 KiB
4Elfogadva2/21ms316 KiB
5Elfogadva2/21ms316 KiB
6Elfogadva2/21ms316 KiB
7Elfogadva2/21ms316 KiB
8Elfogadva2/21ms508 KiB
9Elfogadva2/22ms444 KiB
10Elfogadva2/22ms316 KiB
11Elfogadva2/23ms316 KiB
12Elfogadva2/24ms564 KiB
13Elfogadva2/24ms624 KiB
14Elfogadva2/23ms564 KiB
15Elfogadva3/33ms316 KiB
16Elfogadva3/34ms544 KiB
17Elfogadva3/37ms820 KiB
18Elfogadva3/38ms976 KiB
19Elfogadva3/314ms1580 KiB
20Elfogadva3/314ms824 KiB
21Elfogadva4/414ms1716 KiB
22Elfogadva4/414ms1588 KiB