結果

問題 No.2518 Adjacent Larger
ユーザー atcoder8atcoder8
提出日時 2023-10-27 23:38:17
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 525 bytes
コンパイル時間 629 ms
コンパイル使用メモリ 81,776 KB
実行使用メモリ 100,804 KB
最終ジャッジ日時 2023-10-27 23:38:22
合計ジャッジ時間 4,321 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
53,560 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 87 ms
76,156 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 75 ms
100,612 KB
testcase_17 AC 57 ms
82,912 KB
testcase_18 AC 57 ms
82,940 KB
testcase_19 AC 55 ms
80,968 KB
testcase_20 AC 68 ms
89,448 KB
testcase_21 AC 68 ms
95,836 KB
testcase_22 AC 67 ms
95,836 KB
testcase_23 AC 73 ms
100,804 KB
testcase_24 AC 70 ms
100,396 KB
testcase_25 AC 74 ms
100,704 KB
testcase_26 AC 70 ms
100,696 KB
testcase_27 AC 66 ms
98,348 KB
testcase_28 AC 70 ms
100,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    n = int(input())
    aa = list(map(int, input().split()))

    zero_num = aa.count(0)
    two_num = aa.count(2)

    if (
        zero_num == 0
        or zero_num > n // 2
        or two_num == 0
        or two_num > n // 2
        or zero_num != two_num
    ):
        return False

    if any(aa[i] == aa[(i + 1) % n] and aa[i] in (0, 2) for i in range(n)):
        return False

    return True


def main():
    t = int(input())
    for _ in range(t):
        print("Yes" if solve() else "No")


main()
0