結果

問題 No.992 最長増加部分列の数え上げ
ユーザー chinchillachinchilla
提出日時 2020-02-15 21:34:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 803 ms / 2,000 ms
コード長 341 bytes
コンパイル時間 121 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 52,940 KB
最終ジャッジ日時 2024-04-16 03:19:35
合計ジャッジ時間 22,092 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,752 KB
testcase_01 AC 35 ms
10,752 KB
testcase_02 AC 34 ms
10,752 KB
testcase_03 AC 37 ms
10,752 KB
testcase_04 AC 279 ms
26,904 KB
testcase_05 AC 204 ms
22,660 KB
testcase_06 AC 355 ms
30,452 KB
testcase_07 AC 245 ms
25,304 KB
testcase_08 AC 138 ms
18,388 KB
testcase_09 AC 258 ms
25,560 KB
testcase_10 AC 353 ms
30,444 KB
testcase_11 AC 453 ms
35,504 KB
testcase_12 AC 98 ms
16,012 KB
testcase_13 AC 239 ms
24,748 KB
testcase_14 AC 241 ms
24,660 KB
testcase_15 AC 98 ms
15,908 KB
testcase_16 AC 706 ms
48,136 KB
testcase_17 AC 138 ms
18,520 KB
testcase_18 AC 232 ms
24,280 KB
testcase_19 AC 442 ms
35,144 KB
testcase_20 AC 788 ms
51,900 KB
testcase_21 AC 793 ms
52,024 KB
testcase_22 AC 775 ms
51,972 KB
testcase_23 AC 778 ms
51,896 KB
testcase_24 AC 801 ms
51,900 KB
testcase_25 AC 792 ms
51,900 KB
testcase_26 AC 781 ms
51,904 KB
testcase_27 AC 797 ms
52,020 KB
testcase_28 AC 803 ms
51,896 KB
testcase_29 AC 783 ms
51,896 KB
testcase_30 AC 482 ms
51,912 KB
testcase_31 AC 480 ms
52,940 KB
testcase_32 AC 475 ms
52,680 KB
testcase_33 AC 468 ms
52,940 KB
testcase_34 AC 474 ms
52,680 KB
testcase_35 AC 453 ms
51,652 KB
testcase_36 AC 465 ms
51,524 KB
testcase_37 AC 448 ms
51,524 KB
testcase_38 AC 453 ms
51,520 KB
testcase_39 AC 463 ms
51,652 KB
testcase_40 AC 529 ms
51,992 KB
testcase_41 AC 531 ms
51,504 KB
testcase_42 AC 514 ms
51,100 KB
testcase_43 AC 526 ms
50,732 KB
testcase_44 AC 526 ms
51,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect, bisect_left
m = 10**9+7
n = int(input())
a = map(int, input().split())
s, t, c = [], [], []
for v in a:
	l = bisect_left(t, v)
	if l == len(t): s.append([]); t.append(v); c.append(0)
	o = c[l-1] + s[l-1][bisect(s[l-1], (-v, 0))][1] if l else 1
	s[l].append((-v, -c[l]))
	t[l] = v
	c[l] += o
	c[l] %= m
print(c[-1])
0