結果

問題 No.2518 Adjacent Larger
ユーザー ニックネームニックネーム
提出日時 2023-10-27 21:54:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 168 ms / 2,000 ms
コード長 261 bytes
コンパイル時間 325 ms
コンパイル使用メモリ 11,752 KB
実行使用メモリ 13,976 KB
最終ジャッジ日時 2023-10-27 21:54:43
合計ジャッジ時間 3,900 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,028 KB
testcase_01 AC 145 ms
10,048 KB
testcase_02 AC 155 ms
10,048 KB
testcase_03 AC 150 ms
10,048 KB
testcase_04 AC 140 ms
10,048 KB
testcase_05 AC 168 ms
10,048 KB
testcase_06 AC 52 ms
10,052 KB
testcase_07 AC 52 ms
10,056 KB
testcase_08 AC 50 ms
10,056 KB
testcase_09 AC 50 ms
10,048 KB
testcase_10 AC 52 ms
10,052 KB
testcase_11 AC 45 ms
10,176 KB
testcase_12 AC 48 ms
10,164 KB
testcase_13 AC 46 ms
10,172 KB
testcase_14 AC 46 ms
10,164 KB
testcase_15 AC 46 ms
10,164 KB
testcase_16 AC 100 ms
13,340 KB
testcase_17 AC 71 ms
12,116 KB
testcase_18 AC 70 ms
12,128 KB
testcase_19 AC 63 ms
11,748 KB
testcase_20 AC 79 ms
12,496 KB
testcase_21 AC 124 ms
13,976 KB
testcase_22 AC 101 ms
13,976 KB
testcase_23 AC 101 ms
13,976 KB
testcase_24 AC 63 ms
13,248 KB
testcase_25 AC 63 ms
13,976 KB
testcase_26 AC 63 ms
13,976 KB
testcase_27 AC 122 ms
13,976 KB
testcase_28 AC 122 ms
13,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
    n = int(input())
    a = list(map(int,input().split()))
    f = sum(a)==n
    a = [v for v in a if v!=1]
    for i in range(len(a)):
        if a[i-1]==a[i]==0 or a[i-1]==a[i]==2: f = False
    print("Yes" if a and f else "No")
0