42602023-03-20 08:37:06gkataTűzijátékcpp17Accepted 50/5046ms6368 KiB
#include <iostream>
#include <queue>
#define ll long long

using namespace std;

//ifstream cin("t.in");
//ofstream cout("t.out");

vector <ll>x;
deque <ll>mg;

ll n,m,t,a,akt,i,db;

int main()
{
    cin>>n>>m>>t;
    for(i=0;i<n;++i)
    {
        cin>>a;
        x.push_back(a);
    }

    akt=x[m-1];
    mg.push_back(m);
    db=1;

    for(i=m;i<n;++i)
    {
        if(x[i]-akt>=t)
        {
            ++db;
            akt=x[i];
            mg.push_back(i+1);
        }
    }
    akt=x[m-1];

    for(i=m-2;i>=0;--i)
    {
        if(akt-x[i]>=t)
        {
            ++db;
            akt=x[i];
            mg.push_front(i+1);
        }
    }

    cout<<db<<"\n";
    for(auto &e:mg) cout<<e<<" ";

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1808 KiB
2Accepted0/043ms4024 KiB
3Accepted2/23ms2216 KiB
4Accepted2/23ms2460 KiB
5Accepted2/23ms2788 KiB
6Accepted2/23ms3052 KiB
7Accepted2/22ms3016 KiB
8Accepted2/23ms3024 KiB
9Accepted2/24ms3128 KiB
10Accepted2/26ms3560 KiB
11Accepted2/26ms3776 KiB
12Accepted2/28ms4128 KiB
13Accepted2/29ms4248 KiB
14Accepted2/28ms4384 KiB
15Accepted3/38ms4472 KiB
16Accepted3/314ms4472 KiB
17Accepted3/317ms4972 KiB
18Accepted3/320ms5108 KiB
19Accepted3/346ms6084 KiB
20Accepted3/343ms6092 KiB
21Accepted4/443ms6168 KiB
22Accepted4/443ms6368 KiB