243222026-02-09 10:21:07DhaneHaneTűzijátékcpp17Accepted 50/5045ms1964 KiB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> meg;
int main(){
    int n,m,t; cin>>n>>m>>t;
    vector <long long> x(n+1);
    for (int i=1;i<=n;++i){
        cin>>x[i];
    }
    vector<long long> stat(n+1,0);
    meg.push_back(m);
    int tav=0;
    for (int i=m+1;i<=n;++i){
        stat[i]=x[i]-x[i-1];
        if (stat[i]+tav>=t || stat[i]==0) 
        {
            meg.push_back(i);
            tav=0;
        }
        else if (stat[i]+tav<t) tav+=stat[i];
    }
    tav=0;
    for (int i=m-1;i>=1;--i){
        stat[i]=abs(x[i]-x[i+1]);
        if (stat[i]+tav>=t || stat[i]==0) {
            meg.push_back(i);
            tav=0;
        }
        else if (stat[i]+tav<t) tav+=stat[i];
    }
    sort(meg.begin(), meg.end());
    cout<<meg.size()<<"\n";
    for (auto e:meg) cout<<e<<" ";
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms508 KiB
2Accepted0/043ms1964 KiB
3Accepted2/21ms500 KiB
4Accepted2/21ms316 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms316 KiB
7Accepted2/21ms316 KiB
8Accepted2/21ms316 KiB
9Accepted2/23ms316 KiB
10Accepted2/24ms356 KiB
11Accepted2/24ms316 KiB
12Accepted2/28ms564 KiB
13Accepted2/28ms556 KiB
14Accepted2/27ms564 KiB
15Accepted3/38ms700 KiB
16Accepted3/312ms820 KiB
17Accepted3/317ms976 KiB
18Accepted3/319ms1056 KiB
19Accepted3/343ms1960 KiB
20Accepted3/343ms1964 KiB
21Accepted4/443ms1964 KiB
22Accepted4/445ms1964 KiB