結果

問題 No.921 ずんだアロー
ユーザー daku9640daku9640
提出日時 2019-11-08 21:52:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 441 bytes
コンパイル時間 300 ms
コンパイル使用メモリ 10,952 KB
実行使用メモリ 19,812 KB
最終ジャッジ日時 2023-10-13 03:47:36
合計ジャッジ時間 2,631 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,820 KB
testcase_01 AC 15 ms
7,820 KB
testcase_02 AC 15 ms
7,828 KB
testcase_03 AC 15 ms
7,952 KB
testcase_04 AC 16 ms
7,792 KB
testcase_05 AC 15 ms
7,780 KB
testcase_06 AC 15 ms
7,820 KB
testcase_07 AC 15 ms
7,948 KB
testcase_08 AC 16 ms
7,888 KB
testcase_09 AC 15 ms
7,852 KB
testcase_10 AC 72 ms
18,716 KB
testcase_11 AC 77 ms
19,388 KB
testcase_12 AC 28 ms
10,556 KB
testcase_13 AC 59 ms
16,224 KB
testcase_14 AC 64 ms
17,396 KB
testcase_15 AC 44 ms
13,472 KB
testcase_16 AC 20 ms
8,844 KB
testcase_17 AC 66 ms
17,468 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 79 ms
19,592 KB
testcase_24 AC 83 ms
19,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    n = int(input())
    A = [0] + list(map(int, input().split())) + [0]
    B = [0] * (n + 2)
    for i in range(2, n + 1):
        if A[i - 1] == A[i]:
            B[i - 1] = B[i] = 1
    C = B[:]
    for i in range(1, n + 1):
        if B[i - 1] + B[i] + B[i + 1] == 0:
            B[i] = 1
    for i in range(2, n + 1):
        if C[i - 1] + C[i] + C[i + 1] == 0:
            C[i] = 1
    print(max(sum(B), sum(C)))
solve()
0