結果

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

ソースコード

diff #

T=int(input())
for _ in range(T):
    N=int(input())
    A=list(map(int,input().split()))
    now=0
    judge=True
    allone=True
    for i in range(N):
        if A[i]==2:
            now+=1
            allone=False
        elif A[i]==0:
            now-=1
            allone=False
        if now>=2 or now<=-2:
            judge=False
            break
        
    if allone:
        judge=False
        
    if judge:
        print("Yes")
    else:
        print("No")
0