結果

問題 No.2518 Adjacent Larger
ユーザー atcoder8atcoder8
提出日時 2023-10-27 23:21:23
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 472 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 81,544 KB
実行使用メモリ 98,108 KB
最終ジャッジ日時 2023-10-27 23:21:28
合計ジャッジ時間 3,884 ms
ジャッジサーバーID
(参考情報)
judge13 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,364 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
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 78 ms
97,944 KB
testcase_17 AC 61 ms
80,368 KB
testcase_18 AC 61 ms
80,396 KB
testcase_19 AC 60 ms
78,424 KB
testcase_20 AC 68 ms
86,892 KB
testcase_21 AC 71 ms
95,628 KB
testcase_22 AC 74 ms
95,628 KB
testcase_23 AC 78 ms
97,992 KB
testcase_24 AC 76 ms
97,988 KB
testcase_25 AC 79 ms
98,108 KB
testcase_26 AC 77 ms
98,108 KB
testcase_27 AC 73 ms
97,928 KB
testcase_28 AC 76 ms
97,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

    zero = aa.count(0)
    if zero == 0 or zero > n // 2:
        return False

    one = aa.count(0)
    if one == 0 or one > n // 2:
        return False

    if zero != one:
        return False

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

    return True

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