結果

問題 No.2518 Adjacent Larger
ユーザー titiatitia
提出日時 2023-10-27 22:15:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 760 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 11,860 KB
実行使用メモリ 13,196 KB
最終ジャッジ日時 2023-10-27 22:15:51
合計ジャッジ時間 3,394 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
9,912 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 46 ms
9,968 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 102 ms
13,196 KB
testcase_17 AC 77 ms
12,000 KB
testcase_18 AC 65 ms
12,016 KB
testcase_19 AC 60 ms
11,364 KB
testcase_20 AC 76 ms
12,368 KB
testcase_21 AC 99 ms
13,168 KB
testcase_22 AC 98 ms
13,168 KB
testcase_23 AC 99 ms
13,168 KB
testcase_24 AC 80 ms
13,144 KB
testcase_25 AC 83 ms
13,168 KB
testcase_26 AC 83 ms
13,168 KB
testcase_27 AC 97 ms
13,168 KB
testcase_28 AC 96 ms
13,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
"""
from itertools import permutations

AL=list(permutations(range(6)))

for A in AL:
    A=list(A)
    S=[0]*len(A)

    for i in range(len(A)):
        score=0
        for j in [A[i-1],A[(i+1)%len(A)]]:
            if j>A[i]:
                score+=1
        S[i]=score

    print(A[:len(A)],S)
"""
T=int(input())
for tests in range(T):
    N=int(input())
    A=list(map(int,input().split()))

    if A==[1]*N:
        print("No")
        continue

    flag=1

    for i in range(N):
        if A[i]==2 and A[i-1]==2:
            flag=0
        if A[i]==0 and A[i-1]==0:
            flag=0

    if flag==0:
        print("No")
        continue

    if sum(A)==N:
        print("Yes")
    else:
        print("No")

    
0