結果

問題 No.2343 (l+r)/2
ユーザー titiatitia
提出日時 2023-06-10 02:42:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,629 ms / 2,000 ms
コード長 461 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 10,892 KB
実行使用メモリ 10,480 KB
最終ジャッジ日時 2023-08-30 16:43:06
合計ジャッジ時間 3,842 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,808 KB
testcase_01 AC 1,629 ms
7,808 KB
testcase_02 AC 29 ms
7,864 KB
testcase_03 AC 236 ms
7,800 KB
testcase_04 AC 48 ms
9,536 KB
testcase_05 AC 28 ms
8,704 KB
testcase_06 AC 29 ms
8,716 KB
testcase_07 AC 63 ms
8,632 KB
testcase_08 AC 85 ms
8,740 KB
testcase_09 AC 57 ms
8,808 KB
testcase_10 AC 33 ms
8,656 KB
testcase_11 AC 74 ms
10,180 KB
testcase_12 AC 46 ms
9,456 KB
testcase_13 AC 41 ms
9,044 KB
testcase_14 AC 87 ms
10,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T=int(input())
for tests in range(T):
    N=int(input())
    A=list(map(int,input().split()))

    if A[0]==1:
        for i in range(N):
            A[i]^=1

    now=1
    for i in range(1,N):
        if A[i]!=A[i-1]:
            now+=1

    if now%2==0 or now>=9:
        print("Yes")
        continue

    flag=0

    for i in range(N-1):
        if A[i]==A[i+1]==1:
            flag=1

    if flag==1:
        print("Yes")
        continue

    print("No")
0