結果

問題 No.921 ずんだアロー
ユーザー 👑 KazunKazun
提出日時 2020-12-09 04:38:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 224 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 81,644 KB
実行使用メモリ 86,272 KB
最終ジャッジ日時 2023-10-19 04:42:39
合計ジャッジ時間 2,517 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,256 KB
testcase_01 AC 39 ms
53,256 KB
testcase_02 AC 38 ms
53,256 KB
testcase_03 AC 38 ms
53,256 KB
testcase_04 AC 40 ms
53,256 KB
testcase_05 AC 39 ms
53,256 KB
testcase_06 AC 40 ms
53,256 KB
testcase_07 AC 41 ms
53,256 KB
testcase_08 AC 40 ms
53,256 KB
testcase_09 AC 39 ms
53,256 KB
testcase_10 AC 68 ms
82,248 KB
testcase_11 AC 69 ms
86,140 KB
testcase_12 AC 49 ms
65,364 KB
testcase_13 AC 62 ms
78,620 KB
testcase_14 AC 64 ms
80,324 KB
testcase_15 AC 57 ms
72,600 KB
testcase_16 AC 47 ms
61,868 KB
testcase_17 AC 65 ms
81,796 KB
testcase_18 AC 67 ms
84,248 KB
testcase_19 AC 66 ms
84,248 KB
testcase_20 AC 67 ms
84,248 KB
testcase_21 AC 68 ms
84,248 KB
testcase_22 AC 70 ms
84,248 KB
testcase_23 AC 69 ms
86,272 KB
testcase_24 AC 67 ms
84,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=["*"]+list(map(int,input().split()))

DP=[0]*(N+1)
DP[1]=1

M=0
for i in range(2,N+1):
    M=max(M,DP[i-2])
    if A[i-1]==A[i]:
        DP[i]=DP[i-1]+1
    else:
        DP[i]=max(M+1,DP[i-1])
print(DP[-1])
0