結果

問題 No.921 ずんだアロー
ユーザー tcltktcltk
提出日時 2021-01-16 10:48:32
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 280 ms / 2,000 ms
コード長 856 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 87,264 KB
実行使用メモリ 106,056 KB
最終ジャッジ日時 2023-08-18 07:10:38
合計ジャッジ時間 9,269 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 251 ms
92,064 KB
testcase_01 AC 245 ms
92,000 KB
testcase_02 AC 247 ms
92,212 KB
testcase_03 AC 248 ms
92,196 KB
testcase_04 AC 250 ms
92,148 KB
testcase_05 AC 255 ms
91,700 KB
testcase_06 AC 254 ms
91,988 KB
testcase_07 AC 253 ms
91,792 KB
testcase_08 AC 256 ms
92,144 KB
testcase_09 AC 253 ms
92,044 KB
testcase_10 AC 280 ms
104,344 KB
testcase_11 AC 279 ms
105,512 KB
testcase_12 AC 257 ms
93,504 KB
testcase_13 AC 273 ms
103,504 KB
testcase_14 AC 270 ms
104,824 KB
testcase_15 AC 265 ms
100,308 KB
testcase_16 AC 256 ms
92,732 KB
testcase_17 AC 269 ms
106,056 KB
testcase_18 AC 275 ms
105,716 KB
testcase_19 AC 272 ms
105,468 KB
testcase_20 AC 275 ms
105,472 KB
testcase_21 AC 271 ms
105,520 KB
testcase_22 AC 275 ms
105,404 KB
testcase_23 AC 276 ms
105,568 KB
testcase_24 AC 274 ms
105,712 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