結果

問題 No.921 ずんだアロー
ユーザー simamumusimamumu
提出日時 2019-11-08 21:27:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 593 bytes
コンパイル時間 489 ms
コンパイル使用メモリ 11,068 KB
実行使用メモリ 21,516 KB
最終ジャッジ日時 2023-10-13 03:30:51
合計ジャッジ時間 3,454 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
9,960 KB
testcase_01 AC 30 ms
10,032 KB
testcase_02 AC 30 ms
10,076 KB
testcase_03 AC 30 ms
10,064 KB
testcase_04 AC 30 ms
10,068 KB
testcase_05 AC 31 ms
9,956 KB
testcase_06 AC 31 ms
9,896 KB
testcase_07 AC 30 ms
9,928 KB
testcase_08 AC 30 ms
9,848 KB
testcase_09 AC 30 ms
10,000 KB
testcase_10 AC 127 ms
19,760 KB
testcase_11 AC 133 ms
20,992 KB
testcase_12 AC 53 ms
12,296 KB
testcase_13 AC 101 ms
17,980 KB
testcase_14 AC 114 ms
18,676 KB
testcase_15 AC 81 ms
16,288 KB
testcase_16 AC 37 ms
10,684 KB
testcase_17 AC 117 ms
19,244 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 138 ms
21,516 KB
testcase_24 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N = inp()
AA = inpl()


tmpl = []
ba = -1
for a in AA:
    if ba == a:
        tmpl[-1] += 1
    else:
        tmpl.append(1)
    ba = a

L = len(tmpl)

DP = [0]*L

for i,x in enumerate(tmpl):
    DP[i] = max(DP[i-1], DP[i-2] + x)

print(DP[-1])
0