結果

問題 No.2518 Adjacent Larger
ユーザー rlangevinrlangevin
提出日時 2023-10-27 21:35:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 423 bytes
コンパイル時間 351 ms
コンパイル使用メモリ 81,752 KB
実行使用メモリ 97,892 KB
最終ジャッジ日時 2023-10-27 21:35:57
合計ジャッジ時間 3,305 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,512 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 71 ms
97,852 KB
testcase_17 AC 59 ms
80,440 KB
testcase_18 AC 55 ms
80,464 KB
testcase_19 AC 55 ms
78,532 KB
testcase_20 AC 59 ms
86,900 KB
testcase_21 AC 65 ms
95,384 KB
testcase_22 AC 66 ms
95,384 KB
testcase_23 AC 69 ms
97,892 KB
testcase_24 AC 68 ms
95,736 KB
testcase_25 AC 69 ms
97,884 KB
testcase_26 AC 70 ms
97,884 KB
testcase_27 AC 68 ms
97,884 KB
testcase_28 AC 71 ms
97,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

T = int(input())
for _ in range(T):
    N = int(input())
    A = list(map(int, input().split()))
    if 2 not in A or 0 not in A:
        print("No")
        continue
    A.append(A[0])
    flag = 1
    for i in range(N):
        if A[i] == A[i + 1]:
            if A[i] == 0 or A[i] == 2:
                flag = 0
                break
    print("Yes") if flag else print("No") 
    
0