結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,904 KB
testcase_01 AC 16 ms
7,852 KB
testcase_02 AC 15 ms
7,844 KB
testcase_03 AC 16 ms
7,812 KB
testcase_04 AC 16 ms
7,896 KB
testcase_05 AC 16 ms
7,812 KB
testcase_06 AC 16 ms
7,812 KB
testcase_07 AC 16 ms
7,804 KB
testcase_08 AC 16 ms
7,812 KB
testcase_09 AC 16 ms
7,856 KB
testcase_10 AC 67 ms
18,732 KB
testcase_11 AC 71 ms
19,332 KB
testcase_12 AC 28 ms
10,616 KB
testcase_13 AC 55 ms
16,120 KB
testcase_14 AC 61 ms
17,448 KB
testcase_15 AC 41 ms
13,340 KB
testcase_16 AC 19 ms
8,804 KB
testcase_17 AC 60 ms
17,516 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 73 ms
19,600 KB
testcase_24 AC 67 ms
19,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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