20472022-12-15 21:42:47TomaSajtTűzijátékcpp17Accepted 50/5014ms4248 KiB
#include <bits/stdc++.h>
#define speed ios::sync_with_stdio(0);cin.tie(0)
using namespace std;

int main() {
    speed;
    int n, s, t;
    cin >> n >> s >> t;
    vector<int> v(n + 1);
    for (int i = 1; i <= n; i++) cin >> v[i];
    vector<int> res;
    res.push_back(s);
    int lastPos = v[s];
    for (int i = s - 1; i >= 1; i--) {
        if (lastPos - v[i] < t) continue;
        lastPos = v[i];
        res.push_back(i);
    }
    lastPos = v[s];
    for (int i = s + 1; i <= n; i++) {
        if (v[i] - lastPos < t) continue;
        lastPos = v[i];
        res.push_back(i);
    }
    sort(res.begin(), res.end());
    cout << res.size() << '\n';
    for (auto a : res) cout << a << ' ';
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1700 KiB
2Accepted0/014ms2960 KiB
3Accepted2/22ms2068 KiB
4Accepted2/22ms2276 KiB
5Accepted2/22ms2368 KiB
6Accepted2/22ms2372 KiB
7Accepted2/22ms2492 KiB
8Accepted2/22ms2552 KiB
9Accepted2/23ms2568 KiB
10Accepted2/23ms2904 KiB
11Accepted2/23ms3044 KiB
12Accepted2/24ms3164 KiB
13Accepted2/24ms3424 KiB
14Accepted2/24ms3180 KiB
15Accepted3/34ms3184 KiB
16Accepted3/36ms3308 KiB
17Accepted3/37ms3192 KiB
18Accepted3/38ms3492 KiB
19Accepted3/314ms4016 KiB
20Accepted3/314ms4248 KiB
21Accepted4/414ms4216 KiB
22Accepted4/414ms3912 KiB