結果

問題 No.921 ずんだアロー
ユーザー ああいいああいい
提出日時 2022-05-17 10:46:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 340 bytes
コンパイル時間 317 ms
コンパイル使用メモリ 86,912 KB
実行使用メモリ 102,924 KB
最終ジャッジ日時 2023-10-13 07:30:57
合計ジャッジ時間 3,645 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,376 KB
testcase_01 AC 68 ms
71,156 KB
testcase_02 AC 68 ms
71,340 KB
testcase_03 AC 71 ms
71,472 KB
testcase_04 AC 70 ms
71,460 KB
testcase_05 AC 71 ms
71,636 KB
testcase_06 AC 71 ms
71,292 KB
testcase_07 AC 70 ms
71,360 KB
testcase_08 AC 70 ms
71,296 KB
testcase_09 AC 70 ms
71,372 KB
testcase_10 AC 110 ms
100,628 KB
testcase_11 AC 114 ms
102,684 KB
testcase_12 AC 81 ms
78,080 KB
testcase_13 AC 106 ms
96,336 KB
testcase_14 AC 112 ms
98,888 KB
testcase_15 AC 89 ms
85,096 KB
testcase_16 AC 81 ms
76,724 KB
testcase_17 AC 112 ms
100,864 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 116 ms
102,924 KB
testcase_24 AC 92 ms
90,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

l = []
l.append(1)
for i in range(1,N):
    if A[i] == A[i-1]:
        l[-1] += 1
    else:
        l.append(1)
n = len(l)
dp = [[0] * 2 for _ in range(n)]
dp[0][1] = l[0]
for i in range(1,n):
    dp[i][0] = max(dp[i-1][1],dp[i-1][0])
    dp[i][1] = dp[i-1][0] + l[i]
print(max(dp[-1]))
0