Submission #64344
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #include <bits/stdc++.h> //{ START using namespace std; #define int int64_t #define rep(i, a, n) for (int i = (a); i < (n); ++i) #define arep(i, x) for (auto &&i : (x)) #define all(x) (x).begin(), (x).end() template < class A, class B> bool chmax(A &a, const B &b) { //最大値更新 返り値はbool if (a < b) { a = b; return 1; } return 0; } constexpr int INF = 0x3f3f3f3f; //} END signed main( void ) { cin.tie(nullptr); ios_base::sync_with_stdio( false ); int n; cin >> n; vector< int > x(n); arep(i, x) cin >> i; vector< int > fdp(n, INF), bdp(n, INF); vector< int > ans(n, 0); int sing = 0; rep(i, 0, n) { *lower_bound(all(fdp), x[i]) = x[i]; *lower_bound(all(bdp), x[n - (i + 1)]) = x[n - (i + 1)]; ans[i] += lower_bound(all(fdp), INF) - fdp.begin(); ans[n - (i + 1)] += lower_bound(all(bdp), INF) - bdp.begin(); } rep(i,0,n) chmax(sing,ans[i]); cout<<sing-1<< '\n' ; return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 1418 - 山形数列 |
ユーザー名 | immunity |
投稿日時 | 2020-10-19 16:23:12 |
言語 | C++17 |
状態 | Accepted |
得点 | 1 |
ソースコード長 | 979 Byte |
最大実行時間 | 69 ms |
最大メモリ使用量 | 7060 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 1 / 1 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in01.txt | AC | 46 ms | 3420 KB |
1
|
in02.txt | AC | 31 ms | 640 KB |
1
|
in03.txt | AC | 51 ms | 5280 KB |
1
|
in04.txt | AC | 60 ms | 6700 KB |
1
|
in05.txt | AC | 58 ms | 6800 KB |
1
|
in06.txt | AC | 63 ms | 6772 KB |
1
|
in07.txt | AC | 61 ms | 6740 KB |
1
|
in08.txt | AC | 59 ms | 6708 KB |
1
|
in09.txt | AC | 57 ms | 6680 KB |
1
|
in10.txt | AC | 58 ms | 6768 KB |
1
|
in11.txt | AC | 58 ms | 6740 KB |
1
|
in12.txt | AC | 69 ms | 6708 KB |
1
|
in13.txt | AC | 63 ms | 6932 KB |
1
|
in14.txt | AC | 53 ms | 6896 KB |
1
|
in15.txt | AC | 59 ms | 6860 KB |
1
|
in16.txt | AC | 67 ms | 6828 KB |
1
|
in17.txt | AC | 68 ms | 6796 KB |
1
|
in18.txt | AC | 65 ms | 6892 KB |
1
|
in19.txt | AC | 60 ms | 6868 KB |
1
|
in20.txt | AC | 56 ms | 6840 KB |
1
|
in21.txt | AC | 62 ms | 7060 KB |
1
|
in22.txt | AC | 61 ms | 7024 KB |
1
|
in23.txt | AC | 59 ms | 6992 KB |
1
|
in24.txt | AC | 46 ms | 6960 KB |
1
|
in25.txt | AC | 39 ms | 6924 KB |
1
|
in26.txt | AC | 43 ms | 6896 KB |
1
|
in27.txt | AC | 24 ms | 596 KB |
1
|
in28.txt | AC | 20 ms | 552 KB |
1
|
in29.txt | AC | 25 ms | 632 KB |
1
|
in30.txt | AC | 24 ms | 584 KB |
1
|
in31.txt | AC | 26 ms | 664 KB |
1
|
in32.txt | AC | 19 ms | 488 KB |
1
|
in33.txt | AC | 18 ms | 448 KB |
1
|
in34.txt | AC | 26 ms | 532 KB |
1
|
in35.txt | AC | 59 ms | 7004 KB |
1
|
in36.txt | AC | 57 ms | 6976 KB |
1
|
sample01.txt | AC | 28 ms | 672 KB |
1
|
sample02.txt | AC | 20 ms | 760 KB |
1
|