結果
| 問題 | 
                            No.2518 Adjacent Larger
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2023-10-27 21:38:36 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 338 bytes | 
| コンパイル時間 | 180 ms | 
| コンパイル使用メモリ | 82,468 KB | 
| 実行使用メモリ | 102,104 KB | 
| 最終ジャッジ日時 | 2024-09-25 13:43:43 | 
| 合計ジャッジ時間 | 3,915 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 14 WA * 14 | 
ソースコード
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.append(a[0])
	ok1 = True
	ok2 = False
	ok3 = False
	s = 0
	for i in range(n):
		if a[i] == a[i + 1] != 1:
			ok1 = False
		if a[i] == 0:
			ok2 = True
		if a[i] == 2:
			ok3 = True
		s += a[i]
	print("Yes" if ok1 and ok2 and ok3 and s == n else "No")