結果
| 問題 | 
                            No.2518 Adjacent Larger
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2023-10-27 22:50:11 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 171 ms / 2,000 ms | 
| コード長 | 528 bytes | 
| コンパイル時間 | 249 ms | 
| コンパイル使用メモリ | 82,396 KB | 
| 実行使用メモリ | 112,896 KB | 
| 最終ジャッジ日時 | 2024-09-25 14:52:21 | 
| 合計ジャッジ時間 | 4,075 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 28 | 
ソースコード
def ip():return int(input())
def mp():return map(int, input().split())
def lmp():return list(map(int, input().split()))
T = ip()
from collections import defaultdict
def solve():
    N = ip()
    A = lmp()
    B = []
    for a in A:
        if a == 1:
            continue
        B.append(a)
    if len(B) == 0:
        print('No')
        return
    # B.append(B[0])
    # print(B)
    for i in range(len(B)):
        if B[i-1] == B[i]:
            print('No')
            return
    print('Yes')
for _ in range(T):
    solve()