/* -*- coding: utf-8 -*- * * 3611.cc: No.3611 Omega Cat・・udging ver.・・- yukicoder */ #include #include using namespace std; /* constant */ const int MAX_N = 200000; /* typedef */ /* global variables */ int hs[MAX_N]; /* subroutines */ /* main */ int main() { int tn; scanf("%d", &tn); while (tn--) { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", hs + i); int x = 0; while (x + 1 < n && hs[x] > hs[x + 1]) x++; if (x <= 0 || x >= n - 1) { puts("No"); continue; } int y = x; while (y + 1 < n && hs[y] < hs[y + 1]) y++; if (y <= x || y >= n - 1) { puts("No"); continue; } int z = y; while (z + 1 < n && hs[z] > hs[z + 1]) z++; if (z <= y || z >= n - 1) { puts("No"); continue; } int w = z; while (w + 1 < n && hs[w] < hs[w + 1]) w++; if (w != n - 1) { puts("No"); continue; } puts("Yes"); } return 0; }