結果

問題 No.2343 (l+r)/2
ユーザー lloyzlloyz
提出日時 2023-06-09 22:43:25
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,131 bytes
コンパイル時間 527 ms
コンパイル使用メモリ 86,952 KB
実行使用メモリ 95,216 KB
最終ジャッジ日時 2023-08-30 13:52:09
合計ジャッジ時間 3,802 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,232 KB
testcase_01 AC 604 ms
78,908 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 94 ms
89,512 KB
testcase_05 AC 85 ms
79,144 KB
testcase_06 AC 85 ms
77,956 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 84 ms
77,960 KB
testcase_11 AC 97 ms
90,568 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 102 ms
95,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
    n = int(input())
    A = list(map(int, input().split()))
    B = [A[0]]
    for i in range(1, n):
        if A[i] == A[i - 1]:
            continue
        B.append(A[i])
    if B[0] == 1:
        if len(B) % 2 == 0:
            print("Yes")
        else:
            seq_0 = False
            cnt = 0
            for i in range(n):
                if A[i] == 1:
                    cnt = 0
                else:
                    cnt += 1
                    if cnt > 1:
                        seq_0 = True
                        break
            if seq_0:
                print("Yes")
            else:
                print("No")
    else:
        if len(B) % 2 == 0:
            print("Yes")
        else:
            seq_1 = False
            cnt = 0
            for i in range(n):
                if A[i] == 0:
                    cnt = 0
                else:
                    cnt += 1
                    if cnt > 1:
                        seq_1 = True
                        break
            if seq_1:
                print("Yes")
            else:
                print("No")
0