結果

問題 No.1438 Broken Drawers
ユーザー convexineqconvexineq
提出日時 2021-03-26 21:33:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 286 bytes
コンパイル時間 1,210 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 111,660 KB
最終ジャッジ日時 2023-08-19 07:34:59
合計ジャッジ時間 4,997 ms
ジャッジサーバーID
(参考情報)
judge14 / judge10
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
71,404 KB
testcase_01 AC 61 ms
71,588 KB
testcase_02 AC 62 ms
71,392 KB
testcase_03 AC 60 ms
71,292 KB
testcase_04 AC 60 ms
71,240 KB
testcase_05 AC 63 ms
71,344 KB
testcase_06 AC 115 ms
108,208 KB
testcase_07 AC 115 ms
108,244 KB
testcase_08 AC 61 ms
71,300 KB
testcase_09 AC 60 ms
71,368 KB
testcase_10 AC 61 ms
71,232 KB
testcase_11 AC 71 ms
76,412 KB
testcase_12 AC 83 ms
89,788 KB
testcase_13 AC 95 ms
99,216 KB
testcase_14 AC 80 ms
84,768 KB
testcase_15 AC 117 ms
111,660 KB
testcase_16 AC 111 ms
110,024 KB
testcase_17 AC 118 ms
111,636 KB
testcase_18 AC 121 ms
110,248 KB
testcase_19 AC 120 ms
110,460 KB
testcase_20 AC 124 ms
109,268 KB
testcase_21 AC 120 ms
110,428 KB
testcase_22 AC 120 ms
109,144 KB
testcase_23 AC 119 ms
108,136 KB
testcase_24 AC 122 ms
108,196 KB
testcase_25 AC 119 ms
108,136 KB
testcase_26 AC 120 ms
108,132 KB
testcase_27 AC 119 ms
108,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
*a, = map(int,input().split())

dp = [0]*(n+1)
acc = [0]*(n+1)
dp[0] = acc[0] = 1
for i in range(1,n):
    if a[i] > a[i-1]:
        dp[i] = acc[i-1]+1
        acc[i] = acc[i-1]+1
    else:
        dp[i] = acc[i-2]+1
        acc[i] = max(acc[i-1],dp[i])
print(acc[n-1])
0