結果

問題 No.921 ずんだアロー
ユーザー kohei2019kohei2019
提出日時 2022-05-14 14:04:52
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 377 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 87,240 KB
実行使用メモリ 102,688 KB
最終ジャッジ日時 2023-09-30 05:11:41
合計ジャッジ時間 4,099 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,148 KB
testcase_01 AC 76 ms
71,320 KB
testcase_02 AC 72 ms
71,272 KB
testcase_03 AC 72 ms
71,140 KB
testcase_04 AC 72 ms
71,328 KB
testcase_05 AC 74 ms
71,136 KB
testcase_06 AC 72 ms
71,408 KB
testcase_07 AC 72 ms
71,204 KB
testcase_08 AC 74 ms
71,300 KB
testcase_09 AC 73 ms
71,356 KB
testcase_10 AC 118 ms
100,104 KB
testcase_11 AC 120 ms
101,872 KB
testcase_12 AC 84 ms
78,072 KB
testcase_13 AC 110 ms
95,892 KB
testcase_14 AC 113 ms
98,116 KB
testcase_15 AC 89 ms
84,944 KB
testcase_16 AC 79 ms
76,324 KB
testcase_17 AC 116 ms
100,204 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 115 ms
102,688 KB
testcase_24 AC 92 ms
90,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
lsA = list(map(int,input().split()))
ll = []
cnt = 1

for i in range(1,N):
    if lsA[i-1] == lsA[i]:
        cnt += 1
    else:
        ll.append(cnt)
        cnt = 1
ll.append(cnt)
NN = len(ll)
dp = [[0,0] for i in range(NN+1)]

for i in range(1,NN+1):
    v = ll[i-1]
    dp[i][0] = max(dp[i-1][1],dp[i-1][0])
    dp[i][1] = dp[i-1][0]+v

print(max(dp[NN]))
0