結果

問題 No.921 ずんだアロー
ユーザー paruf4paruf4
提出日時 2020-06-24 22:04:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 100 ms / 2,000 ms
コード長 185 bytes
コンパイル時間 429 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 91,052 KB
最終ジャッジ日時 2023-09-16 21:23:06
合計ジャッジ時間 3,682 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,292 KB
testcase_01 AC 66 ms
71,404 KB
testcase_02 AC 65 ms
71,132 KB
testcase_03 AC 66 ms
71,292 KB
testcase_04 AC 66 ms
71,516 KB
testcase_05 AC 68 ms
71,296 KB
testcase_06 AC 68 ms
71,380 KB
testcase_07 AC 66 ms
71,244 KB
testcase_08 AC 67 ms
71,304 KB
testcase_09 AC 67 ms
71,400 KB
testcase_10 AC 100 ms
88,996 KB
testcase_11 AC 91 ms
90,872 KB
testcase_12 AC 77 ms
77,600 KB
testcase_13 AC 86 ms
85,892 KB
testcase_14 AC 86 ms
87,268 KB
testcase_15 AC 81 ms
82,316 KB
testcase_16 AC 76 ms
76,516 KB
testcase_17 AC 88 ms
88,848 KB
testcase_18 AC 86 ms
90,848 KB
testcase_19 AC 85 ms
90,976 KB
testcase_20 AC 85 ms
90,984 KB
testcase_21 AC 87 ms
90,912 KB
testcase_22 AC 86 ms
90,840 KB
testcase_23 AC 86 ms
91,052 KB
testcase_24 AC 86 ms
90,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int,input().split()))
dp=[0]*(n+1)
dp[1]=1
for i in range(1,n):
  if a[i]==a[i-1]:
    dp[i+1]=dp[i]+1
  else:
    dp[i+1]=max(dp[i],dp[i-1]+1)
print(dp[-1])

0