結果

問題 No.2343 (l+r)/2
ユーザー Kude
提出日時 2023-06-09 22:09:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 633 ms / 2,000 ms
コード長 364 bytes
コンパイル時間 442 ms
コンパイル使用メモリ 82,248 KB
実行使用メモリ 85,704 KB
最終ジャッジ日時 2025-01-02 03:13:32
合計ジャッジ時間 2,765 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(n, a):
    if a[0] != a[-1]:
        return 1
    x = a[0]
    for i in range(n):
        a[i] ^= x
    for i in range(n - 1):
        if a[i] == a[i+1] == 1:
            return 1
    return a.count(1) >= 4

for _ in range(int(input())):
    n = int(input())
    a = list(map(int, input().split()))
    res = solve(n, a)
    print('Yes' if res else 'No')
0