結果

問題 No.921 ずんだアロー
ユーザー kohei2019kohei2019
提出日時 2022-05-14 14:30:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 429 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 86,992 KB
実行使用メモリ 102,352 KB
最終ジャッジ日時 2023-09-30 05:50:57
合計ジャッジ時間 3,720 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
71,228 KB
testcase_01 AC 62 ms
71,284 KB
testcase_02 AC 60 ms
71,360 KB
testcase_03 AC 65 ms
71,224 KB
testcase_04 AC 60 ms
71,304 KB
testcase_05 AC 63 ms
70,928 KB
testcase_06 AC 63 ms
71,172 KB
testcase_07 AC 63 ms
71,304 KB
testcase_08 AC 62 ms
71,216 KB
testcase_09 AC 61 ms
71,096 KB
testcase_10 AC 123 ms
99,448 KB
testcase_11 AC 120 ms
101,804 KB
testcase_12 AC 83 ms
80,204 KB
testcase_13 AC 109 ms
95,780 KB
testcase_14 AC 112 ms
97,924 KB
testcase_15 AC 99 ms
89,332 KB
testcase_16 AC 78 ms
76,592 KB
testcase_17 AC 120 ms
99,652 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 116 ms
102,352 KB
testcase_24 AC 83 ms
89,736 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

ans = 0
for i in range(NN+1):
    ans = max(ans,max(dp[i]))
print(ans)
0