結果

問題 No.921 ずんだアロー
ユーザー mlihua09mlihua09
提出日時 2020-09-17 16:07:37
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 100 ms / 2,000 ms
コード長 269 bytes
コンパイル時間 1,272 ms
コンパイル使用メモリ 86,588 KB
実行使用メモリ 91,796 KB
最終ジャッジ日時 2023-09-04 07:17:18
合計ジャッジ時間 5,304 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,260 KB
testcase_01 AC 74 ms
71,308 KB
testcase_02 AC 74 ms
71,380 KB
testcase_03 AC 75 ms
71,220 KB
testcase_04 AC 74 ms
71,192 KB
testcase_05 AC 76 ms
71,364 KB
testcase_06 AC 75 ms
71,220 KB
testcase_07 AC 74 ms
71,192 KB
testcase_08 AC 74 ms
71,248 KB
testcase_09 AC 75 ms
71,204 KB
testcase_10 AC 95 ms
89,740 KB
testcase_11 AC 95 ms
91,696 KB
testcase_12 AC 82 ms
77,488 KB
testcase_13 AC 91 ms
86,452 KB
testcase_14 AC 93 ms
87,972 KB
testcase_15 AC 89 ms
82,420 KB
testcase_16 AC 80 ms
76,360 KB
testcase_17 AC 95 ms
89,396 KB
testcase_18 AC 98 ms
91,648 KB
testcase_19 AC 96 ms
91,796 KB
testcase_20 AC 97 ms
91,652 KB
testcase_21 AC 99 ms
91,672 KB
testcase_22 AC 99 ms
91,480 KB
testcase_23 AC 100 ms
91,452 KB
testcase_24 AC 99 ms
91,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

ans1 = 1
ans2 = 0

A = list(map(int, input().split())) + [0]

for i in range(N):
    if A[i + 1] == A[i]:
        ans1, ans2 = max(ans1, ans2) + 1, max(ans1, ans2)
        
    else:
        ans1, ans2 = ans2 + 1, max(ans1, ans2)
        
print(ans2)
0