結果

問題 No.921 ずんだアロー
ユーザー tcltk
提出日時 2021-01-16 10:48:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 186 ms / 2,000 ms
コード長 856 bytes
コンパイル時間 802 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 102,912 KB
最終ジャッジ日時 2024-11-27 10:49:22
合計ジャッジ時間 6,463 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#region Header
#!/usr/bin/env python3
# from typing import *

import sys
import io
import math
import collections
import decimal
import itertools
from queue import PriorityQueue
import bisect
import heapq

def input():
    return sys.stdin.readline()[:-1]

sys.setrecursionlimit(1000000)
#endregion

# _INPUT = """9
# 1 2 2 2 1 3 2 2 2
# """
# sys.stdin = io.StringIO(_INPUT)


def main():
    N = int(input())
    A = list(map(int, input().split()))

    i = 0
    n = 0
    zunda = False
    last_size = -1
    while i < N:
        if not zunda:
            zunda = True
            n += 1
            last_size = A[i]
        else:
            if A[i] == last_size:
                n += 1
            else:
                zunda = False
        i += 1
    print(n)

if __name__ == '__main__':
    main()
0