ZOJ-4024 Peak
https://vjudge.net/problem/ZOJ-4024
#include<iostream>
#include<algorithm>
using namespace std;
const int N=1e5+10;
int h[N];
int main()
{
int T,n;
cin>>T;
while(T--)
{
scanf("%d",&n);
for(int i=1;i<=n;i++) scanf("%d",&h[i]);
int l=1,r=n;
while(l<n && h[l]<h[l+1]) l++;
while(r>1 && h[r-1]>h[r]) r--;
if(l==r && l>1 && l<n) cout<<"Yes\n";
else cout<<"No\n";
}
return 0;
}
本文来自博客园,作者:斯文~,转载请注明原文链接:https://www.cnblogs.com/zhiweb/p/15483235.html

浙公网安备 33010602011771号