結果

問題 No.2343 (l+r)/2
ユーザー miya145592miya145592
提出日時 2023-06-09 21:59:22
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 524 bytes
コンパイル時間 310 ms
コンパイル使用メモリ 86,700 KB
実行使用メモリ 94,976 KB
最終ジャッジ日時 2023-08-30 13:16:14
合計ジャッジ時間 3,336 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,304 KB
testcase_01 AC 647 ms
79,048 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 93 ms
86,984 KB
testcase_05 AC 83 ms
78,732 KB
testcase_06 AC 80 ms
77,656 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 83 ms
77,912 KB
testcase_11 AC 95 ms
90,544 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 102 ms
94,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
for _ in range(T):
    N = int(input())
    A = list(map(int, input().split()))
    cnt = 0
    for a in A:
        if a==1:
            cnt+=1
    if cnt*2==N:
        print("Yes")
        continue

    if cnt>N-cnt:
        sa = cnt - (N-cnt)
        chk = 1
    else:
        sa = (N-cnt) - cnt
        chk  =0
    tmp = 0
    for i in range(N-1):
        if A[i]==A[i+1]==chk:
            tmp += 1
        if tmp==sa:
            break
    if tmp==sa:
        print("Yes")
    else:
        print("No")
0