我是靠谱客的博主 文静战斗机,这篇文章主要介绍Codeforces Global Round 17 E. AmShZ and G.O.A.T.,现在分享给大家,希望可以做个参考。

#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
int t,n,a[N];

int main(){
    scanf("%d",&t);
    while(t--){
        scanf("%d",&n);for(int i=1;i<=n;i++)scanf("%d",&a[i]);
        int ans=0;
        for(int i=1;i<=n;i++){
            if(a[i]==a[i-1]) continue;
            int cnt=0,pos=i;
            while(pos<=n){
                pos=lower_bound(a+1+pos,a+1+n,2*a[pos]-a[i])-a;
                cnt++;
            }
            ans=max(ans,cnt);
        }
        cout<<n-ans<<endl;
    }
}

最后

以上就是文静战斗机最近收集整理的关于Codeforces Global Round 17 E. AmShZ and G.O.A.T.的全部内容,更多相关Codeforces内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(48)

评论列表共有 0 条评论

立即
投稿
返回
顶部