結果

問題 No.921 ずんだアロー
ユーザー tcltktcltk
提出日時 2021-01-16 10:48:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 160 ms / 2,000 ms
コード長 856 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 103,040 KB
最終ジャッジ日時 2024-05-05 13:08:07
合計ジャッジ時間 5,519 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
89,088 KB
testcase_01 AC 140 ms
89,088 KB
testcase_02 AC 138 ms
88,960 KB
testcase_03 AC 133 ms
88,960 KB
testcase_04 AC 136 ms
88,960 KB
testcase_05 AC 135 ms
89,088 KB
testcase_06 AC 133 ms
88,960 KB
testcase_07 AC 130 ms
88,960 KB
testcase_08 AC 133 ms
88,704 KB
testcase_09 AC 135 ms
88,960 KB
testcase_10 AC 152 ms
101,120 KB
testcase_11 AC 156 ms
102,784 KB
testcase_12 AC 141 ms
89,728 KB
testcase_13 AC 150 ms
97,792 KB
testcase_14 AC 149 ms
99,072 KB
testcase_15 AC 142 ms
94,464 KB
testcase_16 AC 139 ms
89,088 KB
testcase_17 AC 154 ms
100,480 KB
testcase_18 AC 154 ms
102,912 KB
testcase_19 AC 157 ms
102,912 KB
testcase_20 AC 155 ms
102,912 KB
testcase_21 AC 157 ms
102,912 KB
testcase_22 AC 154 ms
102,784 KB
testcase_23 AC 160 ms
103,040 KB
testcase_24 AC 158 ms
102,784 KB
権限があれば一括ダウンロードができます

ソースコード

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