結果

問題 No.992 最長増加部分列の数え上げ
ユーザー %20%20
提出日時 2020-02-06 01:02:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 240 ms / 2,000 ms
コード長 361 bytes
コンパイル時間 1,199 ms
コンパイル使用メモリ 81,784 KB
実行使用メモリ 107,748 KB
最終ジャッジ日時 2023-10-25 22:44:19
合計ジャッジ時間 10,424 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,452 KB
testcase_01 AC 35 ms
53,452 KB
testcase_02 AC 34 ms
53,452 KB
testcase_03 AC 34 ms
53,452 KB
testcase_04 AC 127 ms
85,396 KB
testcase_05 AC 113 ms
83,024 KB
testcase_06 AC 145 ms
88,508 KB
testcase_07 AC 122 ms
84,008 KB
testcase_08 AC 99 ms
80,148 KB
testcase_09 AC 122 ms
84,288 KB
testcase_10 AC 139 ms
88,508 KB
testcase_11 AC 163 ms
91,604 KB
testcase_12 AC 90 ms
78,216 KB
testcase_13 AC 123 ms
84,144 KB
testcase_14 AC 117 ms
83,892 KB
testcase_15 AC 93 ms
78,616 KB
testcase_16 AC 212 ms
98,732 KB
testcase_17 AC 100 ms
80,032 KB
testcase_18 AC 117 ms
83,848 KB
testcase_19 AC 159 ms
91,560 KB
testcase_20 AC 219 ms
99,984 KB
testcase_21 AC 240 ms
100,708 KB
testcase_22 AC 226 ms
100,684 KB
testcase_23 AC 237 ms
100,052 KB
testcase_24 AC 231 ms
100,888 KB
testcase_25 AC 230 ms
100,632 KB
testcase_26 AC 226 ms
100,216 KB
testcase_27 AC 217 ms
100,324 KB
testcase_28 AC 220 ms
100,756 KB
testcase_29 AC 226 ms
100,836 KB
testcase_30 AC 164 ms
106,696 KB
testcase_31 AC 188 ms
107,588 KB
testcase_32 AC 169 ms
106,836 KB
testcase_33 AC 166 ms
106,700 KB
testcase_34 AC 180 ms
106,096 KB
testcase_35 AC 166 ms
100,156 KB
testcase_36 AC 166 ms
100,156 KB
testcase_37 AC 163 ms
100,156 KB
testcase_38 AC 163 ms
100,156 KB
testcase_39 AC 163 ms
100,156 KB
testcase_40 AC 172 ms
106,108 KB
testcase_41 AC 173 ms
106,060 KB
testcase_42 AC 167 ms
106,188 KB
testcase_43 AC 191 ms
107,748 KB
testcase_44 AC 169 ms
106,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

inf=2*10**9
MD=10**9+7

N=int(input())
A=map(int,input().split())
dp1=[-inf]
dp2=[[-inf,inf]]
dp4=[[0,1]]
for a in A:
	x=bisect.bisect_left(dp1,a)
	if x==len(dp1):
		dp1+=[a]
		dp2+=[[-inf]]
		dp4+=[[0]]
	else:
		dp1[x]=a
	dp2[x]+=[-a]
	y=bisect.bisect_right(dp2[x-1],-a)-1;
	dp4[x]+=[(dp4[x][-1]+dp4[x-1][-1]-dp4[x-1][y])%MD]
print(dp4[-1][-1])
0