結果

問題 No.2343 (l+r)/2
ユーザー ShirotsumeShirotsume
提出日時 2023-06-09 22:25:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 674 bytes
コンパイル時間 472 ms
コンパイル使用メモリ 87,028 KB
実行使用メモリ 99,964 KB
最終ジャッジ日時 2023-08-30 13:35:07
合計ジャッジ時間 4,290 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
73,580 KB
testcase_01 AC 237 ms
83,336 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 143 ms
91,516 KB
testcase_05 AC 130 ms
83,528 KB
testcase_06 AC 129 ms
82,832 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 130 ms
82,884 KB
testcase_11 AC 148 ms
95,280 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 155 ms
99,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, time, random, itertools, heapq, math
from collections import deque, Counter, defaultdict
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353

def solve():
    n = ii()
    a = li()

    dp = [[0, 0], [0, 0]]

    dp[a[0]][0] = 1

    for i in range(1, n):
        e = [[0, 0], [0, 0]]
        for j in range(2):
            e[a[i]][(j + 1) % 2] |= dp[1 - a[i]][j]
            e[a[i]][j] |= dp[a[i]][j]
        e[a[i]][0] |= dp[a[i]][1]
        dp = e
    print('Yes' if dp[0][1] or dp[1][1] else 'No')
        

for _ in range(ii()):
    solve()
0