結果

問題 No.2343 (l+r)/2
ユーザー とろちゃ
提出日時 2023-06-09 21:19:15
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 544 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 11,904 KB
最終ジャッジ日時 2025-01-02 02:05:36
合計ジャッジ時間 1,843 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 1
other RE * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
for _ in range(T):
    N = int(input())
    A = "".join(input().split())
    cnt1 = A.count("1")
    cnt0 = A.count("0")
    rle = RLE(A)
    if cnt1 > cnt0:
        rle1 = len(rle[0::2]) if rle[0][0] == "1" else len(rle[1::2])
        if cnt0 >= rle1:
            print("Yes")
        else:
            print("No")
    elif cnt1 < cnt0:
        rle0 = len(rle[0::2]) if rle[0][0] == "0" else len(rle[1::2])
        if cnt1 >= rle0:
            print("Yes")
        else:
            print("No")
    else:
        print("Yes")
0