結果

問題 No.992 最長増加部分列の数え上げ
ユーザー %20%20
提出日時 2020-02-06 01:01:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 542 ms / 2,000 ms
コード長 361 bytes
コンパイル時間 790 ms
コンパイル使用メモリ 11,832 KB
実行使用メモリ 42,004 KB
最終ジャッジ日時 2023-10-25 22:45:09
合計ジャッジ時間 17,393 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,052 KB
testcase_01 AC 27 ms
10,052 KB
testcase_02 AC 27 ms
10,052 KB
testcase_03 AC 28 ms
10,052 KB
testcase_04 AC 205 ms
21,920 KB
testcase_05 AC 156 ms
18,856 KB
testcase_06 AC 253 ms
24,676 KB
testcase_07 AC 185 ms
20,776 KB
testcase_08 AC 110 ms
15,544 KB
testcase_09 AC 196 ms
20,916 KB
testcase_10 AC 256 ms
24,740 KB
testcase_11 AC 310 ms
28,420 KB
testcase_12 AC 80 ms
13,700 KB
testcase_13 AC 181 ms
20,292 KB
testcase_14 AC 179 ms
20,236 KB
testcase_15 AC 82 ms
13,932 KB
testcase_16 AC 476 ms
37,620 KB
testcase_17 AC 110 ms
15,548 KB
testcase_18 AC 174 ms
19,944 KB
testcase_19 AC 313 ms
28,140 KB
testcase_20 AC 509 ms
40,596 KB
testcase_21 AC 526 ms
40,596 KB
testcase_22 AC 520 ms
40,596 KB
testcase_23 AC 529 ms
40,596 KB
testcase_24 AC 542 ms
40,596 KB
testcase_25 AC 529 ms
40,596 KB
testcase_26 AC 508 ms
40,596 KB
testcase_27 AC 537 ms
40,596 KB
testcase_28 AC 534 ms
40,596 KB
testcase_29 AC 526 ms
40,596 KB
testcase_30 AC 419 ms
40,508 KB
testcase_31 AC 423 ms
41,036 KB
testcase_32 AC 425 ms
41,036 KB
testcase_33 AC 420 ms
41,300 KB
testcase_34 AC 420 ms
41,564 KB
testcase_35 AC 409 ms
40,508 KB
testcase_36 AC 410 ms
40,508 KB
testcase_37 AC 409 ms
40,508 KB
testcase_38 AC 413 ms
40,508 KB
testcase_39 AC 419 ms
40,508 KB
testcase_40 AC 442 ms
41,300 KB
testcase_41 AC 434 ms
41,212 KB
testcase_42 AC 439 ms
41,564 KB
testcase_43 AC 444 ms
41,740 KB
testcase_44 AC 428 ms
42,004 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