149702025-02-10 11:21:41csdavidTűzijátékcpp17Wrong answer 17/5014ms1216 KiB
#include <iostream>

using namespace std;

struct varos{
    bool tuzijatek=0, nemlehet=0;
    int tav;
};

int main()
{
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
    int n, telephely, t, elozo=-1000000000, m=1;
    cin >> n >> telephely >> t;
    telephely--;
    varos a[n];
    for(int i=0; i<n; i++){
        cin >> a[i].tav;
    }
    a[telephely].tuzijatek=1;
    for(int i=telephely; i<n&&a[i].tav<a[telephely].tav+t; i++){
        a[i].nemlehet=1;
    }
    for(int i=telephely; i>=n&&a[i].tav>a[telephely].tav-t; i--){
        a[i].nemlehet=1;
    }
    for(int i=0; i<n; i++){
        if(!a[i].nemlehet&&a[i].tav>=elozo+t){
            a[i].nemlehet=1;
            a[i].tuzijatek=1;
            elozo=a[i].tav;
            m++;
        }
        else{
            a[i].nemlehet=1;
        }
    }
    cout << m << '\n';
    for(int i=0; i<n; i++){
        if(a[i].tuzijatek){
            cout << i+1 << ' ';
        }
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base17/50
1Accepted0/01ms316 KiB
2Wrong answer0/014ms1076 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms316 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms316 KiB
7Wrong answer0/21ms316 KiB
8Accepted2/21ms320 KiB
9Accepted2/22ms316 KiB
10Wrong answer0/22ms348 KiB
11Wrong answer0/22ms316 KiB
12Accepted2/23ms564 KiB
13Wrong answer0/23ms560 KiB
14Wrong answer0/23ms564 KiB
15Accepted3/33ms564 KiB
16Wrong answer0/34ms580 KiB
17Wrong answer0/36ms756 KiB
18Wrong answer0/37ms820 KiB
19Wrong answer0/314ms1124 KiB
20Wrong answer0/314ms1204 KiB
21Wrong answer0/414ms1216 KiB
22Wrong answer0/414ms1204 KiB