44332023-03-28 08:25:18gyjazminTűzijátékcpp11Wrong answer 2/5028ms6008 KiB
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
vector<int> telepulesek;
vector<int> tavok;
void elore(int kezdovaros){
    for (int i=1;i<100001;i++){
        if (tavok[kezdovaros-1]-tavok[kezdovaros-i-1]>=100)
        {
            telepulesek.push_back(kezdovaros-i);
            elore(kezdovaros-i);
            break;
        }
        else if (tavok[kezdovaros-1]-100<0)
            break;
    }
}
void hatra(int kezdovaros){
    for (int i=1;i<100001;i++){
        if (tavok[kezdovaros-1]-100<0 || kezdovaros>=tavok.size())
            break;
        else if (tavok[kezdovaros+i-1]-tavok[kezdovaros-1]>=100)
        {
            telepulesek.push_back(kezdovaros+i);
            hatra(kezdovaros+i);
            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);
    hatra(S);
    sort(telepulesek.begin(),telepulesek.end());
    cout << telepulesek.size() << endl;
    for (int i=0;i<telepulesek.size();i++){
        cout << telepulesek[i] << " ";
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base2/50
1Accepted0/03ms2044 KiB
2Wrong answer0/027ms4208 KiB
3Wrong answer0/23ms2308 KiB
4Wrong answer0/23ms2524 KiB
5Wrong answer0/23ms2688 KiB
6Wrong answer0/23ms2772 KiB
7Accepted2/23ms2876 KiB
8Wrong answer0/23ms2772 KiB
9Wrong answer0/24ms3088 KiB
10Wrong answer0/24ms3172 KiB
11Wrong answer0/24ms3480 KiB
12Wrong answer0/24ms3592 KiB
13Wrong answer0/26ms3644 KiB
14Wrong answer0/26ms3848 KiB
15Wrong answer0/34ms4176 KiB
16Wrong answer0/37ms4224 KiB
17Wrong answer0/38ms4172 KiB
18Wrong answer0/39ms4220 KiB
19Wrong answer0/328ms5672 KiB
20Runtime error0/316ms5928 KiB
21Runtime error0/416ms6008 KiB
22Wrong answer0/427ms6004 KiB