43632023-03-27 09:29:441478Tűzijátékcpp17Accepted 50/5045ms4392 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    //ifstream cin("in.txt");
    int n, k, t;
    cin >> n >> k >> t;

    vector<int> a(n + 1);
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    long long d = 0;
    stack<int> s;
    queue<int> q;
    for(int i = k; i > 1; i--){
        d += a[i]-a[i-1];
        if(d>=t){
            d = 0;
            s.push(i-1);
        }
    }

    d=0;
    for(int i = k; i < n; i++){
        d += a[i+1] - a[i];
        if(d>=t){
            d = 0;
            q.push(i+1);
        }
    }

    cout << s.size() + q.size() + 1 << '\n';
    while(s.size()){
        cout << s.top() << " ";
        s.pop();
    }
    cout << k << " ";
    while(q.size()){
        cout << q.front() << " ";
        q.pop();
    }



    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1684 KiB
2Accepted0/043ms2680 KiB
3Accepted2/22ms2056 KiB
4Accepted2/23ms2272 KiB
5Accepted2/23ms2488 KiB
6Accepted2/22ms2568 KiB
7Accepted2/22ms2568 KiB
8Accepted2/22ms2564 KiB
9Accepted2/24ms2588 KiB
10Accepted2/26ms2860 KiB
11Accepted2/26ms3072 KiB
12Accepted2/28ms3064 KiB
13Accepted2/28ms3072 KiB
14Accepted2/28ms3076 KiB
15Accepted3/38ms3336 KiB
16Accepted3/313ms3460 KiB
17Accepted3/317ms3640 KiB
18Accepted3/320ms3596 KiB
19Accepted3/345ms4136 KiB
20Accepted3/343ms4392 KiB
21Accepted4/443ms4332 KiB
22Accepted4/443ms4384 KiB