結果

問題 No.992 最長増加部分列の数え上げ
ユーザー %20%20
提出日時 2020-02-05 23:11:26
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 712 bytes
コンパイル時間 2,402 ms
コンパイル使用メモリ 210,048 KB
実行使用メモリ 9,168 KB
最終ジャッジ日時 2023-10-25 22:44:46
合計ジャッジ時間 7,732 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,372 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 18 ms
4,480 KB
testcase_05 AC 14 ms
4,348 KB
testcase_06 AC 22 ms
4,624 KB
testcase_07 AC 17 ms
4,408 KB
testcase_08 AC 9 ms
4,348 KB
testcase_09 AC 16 ms
4,436 KB
testcase_10 AC 22 ms
4,616 KB
testcase_11 AC 27 ms
4,708 KB
testcase_12 AC 7 ms
4,348 KB
testcase_13 AC 16 ms
4,400 KB
testcase_14 AC 16 ms
4,384 KB
testcase_15 AC 7 ms
4,348 KB
testcase_16 AC 40 ms
5,516 KB
testcase_17 AC 10 ms
4,348 KB
testcase_18 AC 16 ms
4,360 KB
testcase_19 AC 27 ms
4,628 KB
testcase_20 AC 45 ms
5,964 KB
testcase_21 AC 45 ms
5,780 KB
testcase_22 AC 46 ms
5,780 KB
testcase_23 AC 45 ms
5,780 KB
testcase_24 AC 45 ms
5,780 KB
testcase_25 AC 44 ms
5,780 KB
testcase_26 AC 43 ms
5,780 KB
testcase_27 AC 44 ms
5,908 KB
testcase_28 AC 44 ms
5,780 KB
testcase_29 AC 46 ms
5,780 KB
testcase_30 TLE -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

#define all(v) v.begin(),v.end()

using ll=long long;
const int inf=2e9;
const int MD=1e9+7;

int main(){cin.tie(0);ios::sync_with_stdio(false);
	int N;cin>>N;
	vector<int>dp1={-inf};
	vector<vector<int>>dp2={{inf,-inf}};
	vector<vector<int>>dp3={{0,1}};
	for(int _=0;_<N;++_){
		int A;cin>>A;
		int x=lower_bound(all(dp1),A)-dp1.begin();
		if(x==dp1.size()){
			dp1.push_back(A);
			dp2.push_back({inf});
			dp3.push_back({0});
		}else{
			dp1[x]=A;
		}
		dp2[x].push_back(A);
		ll t=0;
		for(int y=dp2[x-1].size()-1;dp2[x-1][y]<A;--y){
			t+=dp3[x-1][y];
		}
		dp3[x].push_back(t%MD);
	}
	ll z=0;
	for(int a:dp3.back()){
		z+=a;
	}
	cout<<z%MD<<"\n";
	return 0;
}
0