結果

問題 No.2518 Adjacent Larger
ユーザー hiro1729
提出日時 2023-10-27 21:30:58
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 287 bytes
コンパイル時間 255 ms
コンパイル使用メモリ 82,160 KB
実行使用メモリ 100,664 KB
最終ジャッジ日時 2024-09-25 13:34:24
合計ジャッジ時間 3,821 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 14 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.append(a[0])
	ok1 = True
	ok2 = False
	s = 0
	for i in range(n):
		if a[i] == a[i + 1] != 1:
			ok1 = False
		if a[i] == 0:
			ok2 = True
		s += a[i]
	print("Yes" if ok1 and ok2 and s == n else "No")
0