結果

問題 No.2518 Adjacent Larger
ユーザー komkompi
提出日時 2023-10-27 22:25:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 425 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 82,452 KB
実行使用メモリ 104,152 KB
最終ジャッジ日時 2024-09-25 14:29:10
合計ジャッジ時間 4,094 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 12 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!

T=int(input())

for _ in range(T):
    N=int(input())
    A=list(map(int,input().split()))
    
    dic={0:0,1:0,2:0}
    prev=-1
    judge=True
    for a in A:
        dic[a]+=1
        if (a==2 and prev==2) or (a==0 and prev==0):
            judge=False
        prev=a
    
    if dic[2]==dic[0] and dic[0]>0 and dic[1]>0 and judge:
        print("Yes")
    else:
        print("No")
    
0