結果

問題 No.2518 Adjacent Larger
ユーザー june19312june19312
提出日時 2023-10-27 22:00:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 611 bytes
コンパイル時間 334 ms
コンパイル使用メモリ 81,848 KB
実行使用メモリ 109,616 KB
最終ジャッジ日時 2023-10-27 22:00:23
合計ジャッジ時間 3,854 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 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 80 ms
76,004 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 82 ms
109,336 KB
testcase_17 AC 58 ms
84,704 KB
testcase_18 AC 60 ms
84,712 KB
testcase_19 AC 53 ms
80,764 KB
testcase_20 AC 62 ms
91,372 KB
testcase_21 AC 67 ms
95,908 KB
testcase_22 AC 65 ms
95,908 KB
testcase_23 AC 83 ms
109,616 KB
testcase_24 AC 81 ms
109,304 KB
testcase_25 AC 81 ms
109,616 KB
testcase_26 AC 81 ms
109,616 KB
testcase_27 AC 66 ms
95,908 KB
testcase_28 AC 81 ms
109,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())

for _ in range(T):
    N = int(input())
    A = list(map(str,input().split()))
    B = "".join(A)
    if "22" in B or "00" in B:
        print("No")
        continue
    if B.find("0") == -1:
        print("No")
        continue
    if B.count("2") != B.count("0"):
        print("No")
        continue
    if B[0] == "0" and B[-1] == "0":
        print("No")
        continue
    if B[0] == "2" and B[-1] == "2":
        print("No")
        continue

    cnt = 0
    for ii,vv in enumerate(A):
        cnt += int(vv)
    if cnt != N:
        print("No")
        continue
    
    print("Yes")
0