K

mail@pastecode.io avatar
unknown
plain_text
2 years ago
955 B
4
Indexable
Never
       ll pre[100] = {0}, post[100] = {0};
int main()
{
    ///FastIO();
    ll t,i,j,m,x,k,y,n;
    t = 1;
    sc1(t);

    while(t--){
        sc2(n,k);
        vector<ll>V;
        for(ll i=0;i<n;i++)
        {
            sc1(x);V.pb(x);
        }
        pre[0] = 1;
        for(ll i=1;i<n;i++) {
            if(V[i]<=V[i-1]) {
                pre[i] = pre[i-1] + 1;
            }
            else {
                pre[i] = 1;
            }
        }
        post[n-1] = 1;
        for(i=n-1;i>=0;i--) {
            if(V[i]<=V[i+1]){
                post[i] += post[i+1] + 1;
            }
            else {
                pre[i] = 1;
            }
        }
        vector<ll>ans;
        for(i=k;i<(n-k);i++) {
            if(V[i]<=V[i-1] && V[i]<=V[i+1] && pre[i-1]>=k && post[i+1]>=k) {
                ans.push_back(i);
                cout<<i<<endl;
            }
        }
    }

    return 0;
}