結果

問題 No.921 ずんだアロー
ユーザー titiatitia
提出日時 2019-11-08 21:50:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 309 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 10,664 KB
実行使用メモリ 21,364 KB
最終ジャッジ日時 2023-10-13 03:46:35
合計ジャッジ時間 2,593 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,820 KB
testcase_01 AC 16 ms
7,864 KB
testcase_02 AC 15 ms
7,788 KB
testcase_03 AC 16 ms
7,776 KB
testcase_04 AC 16 ms
7,836 KB
testcase_05 AC 15 ms
7,868 KB
testcase_06 AC 16 ms
7,832 KB
testcase_07 AC 16 ms
7,928 KB
testcase_08 AC 16 ms
7,812 KB
testcase_09 AC 16 ms
7,956 KB
testcase_10 AC 139 ms
19,944 KB
testcase_11 AC 146 ms
21,364 KB
testcase_12 AC 43 ms
10,940 KB
testcase_13 AC 101 ms
17,184 KB
testcase_14 AC 115 ms
18,588 KB
testcase_15 AC 74 ms
14,368 KB
testcase_16 AC 24 ms
8,968 KB
testcase_17 AC 117 ms
18,764 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 147 ms
21,312 KB
testcase_24 AC 59 ms
19,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))
A.append("?")

NOW=-1
count=0
LIST=[]

for a in A:
    if NOW==a:
        count+=1
    else:
        LIST.append((NOW,count))
        NOW=a
        count=1

DP=[0]*len(LIST)

for i in range(1,len(LIST)):
    DP[i]=max(DP[i-1],DP[i-2]+LIST[i][1])

print(max(DP))
0