結果

問題 No.2518 Adjacent Larger
ユーザー ShirotsumeShirotsume
提出日時 2023-10-25 16:31:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 562 bytes
コンパイル時間 345 ms
コンパイル使用メモリ 81,856 KB
実行使用メモリ 100,624 KB
最終ジャッジ日時 2023-10-25 16:31:49
合計ジャッジ時間 3,885 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
55,916 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 76 ms
76,704 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 78 ms
100,452 KB
testcase_17 AC 67 ms
84,932 KB
testcase_18 AC 65 ms
84,948 KB
testcase_19 AC 62 ms
80,928 KB
testcase_20 AC 68 ms
89,396 KB
testcase_21 AC 74 ms
100,236 KB
testcase_22 AC 75 ms
100,236 KB
testcase_23 AC 80 ms
100,500 KB
testcase_24 AC 82 ms
100,500 KB
testcase_25 AC 81 ms
100,624 KB
testcase_26 AC 80 ms
100,624 KB
testcase_27 AC 79 ms
100,428 KB
testcase_28 AC 79 ms
100,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, time, random
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()
    if 2 not in a or 0 not in a:
        return 'No'
    
    for i in range(n):
        if a[i - 1] == a[i] and a[i] in [0, 2]:
            return 'No'
    
    if sum(a) != n:
        return 'No'
    return 'Yes'

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

0