44412023-03-28 08:58:21gyjazminTűzijátékcpp11Runtime error 10/5014ms5048 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/03ms1888 KiB
2Runtime error0/014ms3236 KiB
3Accepted2/23ms2376 KiB
4Accepted2/23ms2504 KiB
5Accepted2/23ms2620 KiB
6Accepted2/22ms2692 KiB
7Wrong answer0/23ms2964 KiB
8Wrong answer0/23ms3036 KiB
9Wrong answer0/23ms3296 KiB
10Wrong answer0/24ms3620 KiB
11Wrong answer0/24ms3496 KiB
12Wrong answer0/24ms3684 KiB
13Wrong answer0/24ms3644 KiB
14Accepted2/24ms3640 KiB
15Wrong answer0/34ms3912 KiB
16Wrong answer0/36ms3976 KiB
17Runtime error0/37ms4108 KiB
18Runtime error0/38ms4300 KiB
19Runtime error0/314ms4788 KiB
20Runtime error0/314ms5048 KiB
21Runtime error0/414ms5016 KiB
22Runtime error0/414ms4908 KiB