官方题解
2025-09-08 11:21:54
发布于:浙江
16阅读
0回复
0点赞
题目大意
有一个长度为 的数组 ,判断是否存在一个区间 满足 。
解题思路
当 时,一定满足 。所以答案一定是 YES
参考代码
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
void solve(){
int n;cin>>n;
vector<int>a(n+1);
for(int i=1;i<=n;i++) cin>>a[i];
cout<<"YES"<<endl;
}
signed main(){
int T=1;cin>>T;
while(T--){
solve();
}
}
这里空空如也
有帮助,赞一个