結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,592 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 106 ms
77,552 KB
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 83 ms
101,980 KB
testcase_17 AC 60 ms
85,192 KB
testcase_18 AC 59 ms
85,088 KB
testcase_19 AC 58 ms
83,116 KB
testcase_20 AC 64 ms
91,580 KB
testcase_21 AC 81 ms
103,880 KB
testcase_22 AC 85 ms
103,616 KB
testcase_23 AC 76 ms
102,192 KB
testcase_24 AC 75 ms
101,260 KB
testcase_25 AC 76 ms
101,860 KB
testcase_26 AC 75 ms
101,856 KB
testcase_27 AC 76 ms
102,388 KB
testcase_28 AC 75 ms
101,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
T = int(input())
for _ in range(T):
    N = int(input())
    A = list(map(int, input().split()))
    C = collections.Counter(A)
    ans = C[0]==C[2] and C[1]<N
    for i in range(N):
        if A[i]==A[i-1] and A[i]!=1:
            ans = False    
    if ans:
        print('Yes')
    else:
        print('No')
0