結果

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

ソースコード

diff #

def solve():
    n = int(input())
    A = list(map(int, input().split()))
    if sum(A) != n:
        return False
    for i in range(n):
        if A[i] + A[i - 1] not in [1, 2, 3]:
            return False
    if 0 not in A:
        return False
    return True


for _ in range(int(input())):
    if solve():
        print("Yes")
    else:
        print("No")
0