44372023-03-28 08:49:49gyjazminTűzijátékcpp11Runtime error 10/5014ms5324 KiB
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
vector<int> telepulesek;
vector<int> tavok;
void elore(int kezdovaros,int T){
    for (int i=1;i<100001;i++){
        if (tavok[kezdovaros-1]-T<0 || kezdovaros-i<0)
            break;
        else if (tavok[kezdovaros-1]-tavok[kezdovaros-i-1]>=T)
        {
            telepulesek.push_back(kezdovaros-i);
            elore(kezdovaros-i,T);
            break;
        }
    }
}
void hatra(int kezdovaros, int T){
    for (int i=1;i<100001;i++){
        if (kezdovaros>=tavok.size())
            break;
        else if (tavok[kezdovaros+i-1]-tavok[kezdovaros-1]>=T)
        {
            telepulesek.push_back(kezdovaros+i);
            hatra(kezdovaros+i,T);
            break;
        }
    }
}
int main()
{
    iostream::sync_with_stdio(0);    cin.tie(0);
    int N;
    int S;
    int T;
    cin >> N >> S >> T;
    tavok.resize(N);
    for (int i=0;i<N;i++){
        cin >> tavok[i];
    }
   // vector<int> telepulesek;
    telepulesek.push_back(S);
    elore(S,T);
    hatra(S,T);
    sort(telepulesek.begin(),telepulesek.end());
    cout << telepulesek.size() << endl;
    for (int i=0;i<telepulesek.size();i++){
        cout << telepulesek[i] << " ";
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base10/50
1Accepted0/03ms1892 KiB
2Runtime error0/014ms3196 KiB
3Accepted2/23ms2340 KiB
4Accepted2/23ms2584 KiB
5Accepted2/23ms2768 KiB
6Accepted2/22ms2856 KiB
7Wrong answer0/22ms2980 KiB
8Wrong answer0/22ms3060 KiB
9Wrong answer0/23ms3104 KiB
10Wrong answer0/23ms3112 KiB
11Wrong answer0/24ms3416 KiB
12Wrong answer0/24ms3580 KiB
13Wrong answer0/24ms3532 KiB
14Accepted2/24ms3788 KiB
15Wrong answer0/34ms4020 KiB
16Wrong answer0/36ms4372 KiB
17Runtime error0/37ms4360 KiB
18Runtime error0/38ms4596 KiB
19Runtime error0/314ms5216 KiB
20Runtime error0/314ms5324 KiB
21Runtime error0/414ms5304 KiB
22Runtime error0/414ms5160 KiB