結果

問題 No.2697 Range LIS Query
ユーザー nouka28nouka28
提出日時 2024-02-03 16:28:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 698 bytes
コンパイル時間 4,428 ms
コンパイル使用メモリ 263,036 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2024-02-07 21:28:03
合計ジャッジ時間 17,348 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,548 KB
testcase_01 AC 2 ms
6,548 KB
testcase_02 AC 2 ms
6,548 KB
testcase_03 AC 42 ms
6,548 KB
testcase_04 AC 40 ms
6,548 KB
testcase_05 AC 47 ms
6,548 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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


int main(){
    int n;cin>>n;
    vector<int> a(n);for(auto &e:a){cin>>e;e--;}
    int q;cin>>q;
    while(q--){
        int type;cin>>type;
        if(type==1){
            int l,r;cin>>l>>r;l--;
            vector<int> dp;
            for(int i=l;i<r;i++){
                auto p=upper_bound(dp.begin(),dp.end(),a[i]);
                if(p==dp.end())dp.push_back(a[i]);
                else *p=a[i];
            }
            cout<<(int)dp.size()<<endl;
        }
        if(type==2){
            int l,r,x;cin>>l>>r>>x;
            l--;x--;
            for(int i=l;i<r;i++)a[i]=x;   
        }
    }
}
0