結果

問題 No.2518 Adjacent Larger
ユーザー pitPpitP
提出日時 2023-10-27 21:39:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 519 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 81,876 KB
実行使用メモリ 101,820 KB
最終ジャッジ日時 2023-10-27 21:39:49
合計ジャッジ時間 4,168 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,468 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 107 ms
76,984 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 81 ms
100,448 KB
testcase_17 AC 66 ms
84,932 KB
testcase_18 AC 64 ms
84,948 KB
testcase_19 AC 62 ms
80,928 KB
testcase_20 AC 70 ms
89,404 KB
testcase_21 AC 84 ms
101,612 KB
testcase_22 AC 85 ms
101,820 KB
testcase_23 AC 76 ms
100,496 KB
testcase_24 AC 71 ms
98,292 KB
testcase_25 AC 71 ms
98,428 KB
testcase_26 AC 72 ms
98,428 KB
testcase_27 AC 78 ms
100,500 KB
testcase_28 AC 77 ms
98,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
for _ in range(T):
    N = int(input())
    A = list(map(int,input().split()))
    
    f = True
    f &= sum(A) == N

    for i in range(N):
        if A[i] == 0 and A[(i + 1) % N] == 0:
            f = False
        if A[i] == 2 and A[(i + 1) % N] == 2:
            f = False
    
    f0 = False
    f2 = False
    for i in range(N):
        if A[i] == 0: 
            f0 = True
        if A[i] == 2: 
            f2 = True
    
    if f & f0 & f2 :
        print("Yes")
    else:
        print("No")
0