結果
| 問題 |
No.2518 Adjacent Larger
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-10-28 09:13:14 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 997 bytes |
| コンパイル時間 | 433 ms |
| コンパイル使用メモリ | 82,456 KB |
| 実行使用メモリ | 117,504 KB |
| 最終ジャッジ日時 | 2024-09-25 16:12:42 |
| 合計ジャッジ時間 | 6,861 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 17 WA * 11 |
ソースコード
import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
#sys.set_int_max_str_digits(0)
#alist = []
#s = input()
t = int(input())
for _ in range(t):
n = int(input())
alist = list(map(int,input().split()))
if sum(alist) != n:
print('No')
continue
c = 0
for i in range(n):
if alist[i] == 2:
if alist[i-1] == 2 or alist[(i+1)%n] == 2:
print('No')
c = 1
break
if alist[i] == 1:
if alist[i-1] == 2 and alist[(i+1)%n] == 2:
print('No')
c = 1
break
if alist[i] == 0:
if alist[i-1] == 0 or alist[(i+1)%n] == 0:
print('No')
c = 1
break
if alist.count(2) == 0:
print('No')
c = 1
if alist.count(0) == 0:
print('No')
c = 1
if not c:
print('Yes')