結果

問題 No.2518 Adjacent Larger
ユーザー akebono03akebono03
提出日時 2023-10-27 22:37:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 498 bytes
コンパイル時間 336 ms
コンパイル使用メモリ 81,620 KB
実行使用メモリ 101,524 KB
最終ジャッジ日時 2023-10-27 22:37:49
合計ジャッジ時間 4,209 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
55,416 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 94 ms
76,484 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 85 ms
101,304 KB
testcase_17 AC 57 ms
84,688 KB
testcase_18 AC 56 ms
84,716 KB
testcase_19 AC 54 ms
80,696 KB
testcase_20 AC 62 ms
91,208 KB
testcase_21 AC 66 ms
97,740 KB
testcase_22 AC 65 ms
97,740 KB
testcase_23 AC 73 ms
101,524 KB
testcase_24 AC 69 ms
100,388 KB
testcase_25 AC 71 ms
100,988 KB
testcase_26 AC 75 ms
100,992 KB
testcase_27 AC 67 ms
100,252 KB
testcase_28 AC 70 ms
101,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def ip():return int(input())
def mp():return map(int, input().split())
def lmp():return list(map(int, input().split()))
T = ip()
from collections import defaultdict
def solve():
    N = ip()
    A = lmp()
    cnt = defaultdict(int)
    for i in range(N):
        cnt[A[i]] += 1
        if A[i] != 1 and A[i] == A[i-1]:
            print('No')
            return
    if cnt[0] == 0 or cnt[2] == 0 or cnt[0] != cnt[2]:
        print('No')
    else:
        print('Yes')
for _ in range(T):
    solve()
0