結果

問題 No.2697 Range LIS Query
ユーザー nouka28
提出日時 2024-02-03 16:28:18
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 698 bytes
コンパイル時間 4,283 ms
コンパイル使用メモリ 250,488 KB
最終ジャッジ日時 2025-02-19 01:13:30
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 3 TLE * 12
権限があれば一括ダウンロードができます

ソースコード

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