結果

問題 No.2343 (l+r)/2
ユーザー chineristACchineristAC
提出日時 2023-06-09 22:21:11
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 551 bytes
コンパイル時間 354 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 96,356 KB
最終ジャッジ日時 2023-08-30 13:31:29
合計ジャッジ時間 3,131 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
72,096 KB
testcase_01 AC 234 ms
79,564 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 115 ms
87,872 KB
testcase_05 AC 97 ms
79,872 KB
testcase_06 AC 103 ms
79,896 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 99 ms
79,664 KB
testcase_11 AC 113 ms
91,576 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 114 ms
96,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from itertools import permutations

input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

import random

for _ in range(int(input())):
    N = int(input())
    A = li()

    k = A.count(1)
    if k < N-k:
        A = [1-a for a in A]
    
    if A[0] == 0 or A[-1] == 0:
        print("Yes")
        continue

    flg = True
    for i in range(1,N-1):
        if A[i] == 0:
            if A[i-1] == 0 or A[i+1] == 0:
                flg = False
    
    print("No" if flg else "Yes")

0