結果

問題 No.2518 Adjacent Larger
ユーザー komkompikomkompi
提出日時 2023-10-27 22:25:55
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 425 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 81,828 KB
実行使用メモリ 103,532 KB
最終ジャッジ日時 2023-10-27 22:25:59
合計ジャッジ時間 3,971 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
53,572 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 71 ms
100,788 KB
testcase_17 AC 57 ms
85,108 KB
testcase_18 AC 54 ms
82,956 KB
testcase_19 AC 52 ms
80,984 KB
testcase_20 AC 61 ms
89,580 KB
testcase_21 AC 78 ms
103,532 KB
testcase_22 AC 79 ms
103,532 KB
testcase_23 AC 71 ms
101,032 KB
testcase_24 AC 65 ms
100,412 KB
testcase_25 AC 66 ms
100,532 KB
testcase_26 AC 69 ms
100,532 KB
testcase_27 AC 72 ms
101,368 KB
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

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