이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define bn binary_search
#define sz(x) int((x).size())
#define lz(x) long long((x).size())
#define INF 1000000007
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ll> vl;
typedef pair<ll,ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<pair<int,ii>> gw;
typedef vector<pair<ll,il>> lw;
typedef vector<vc> vvc;
vi tail;
int cell(int l,int r, int k){
while(r-l>1){
int m=l+(r-l)/2;
if(tail[m]>=k) r=m;
else l=m;
//cout<<"hier"<<endl;
}
return r;
}
void solve(){
int n, x;
cin>>n>>x;
vi in(n);
for(int i=0;i<n;i++){
cin>>in[i];
}
tail.assign(n,0);
int l=1;
tail[0]=in[0];
for(int i=1;i<n;i++){
if(in[i]<tail[0]){
tail[0]=in[i];
}else if(in[i]>tail[l-1]){
tail[l++]=in[i];
}else{
tail[cell(-1,l-1,in[i])]=in[i];
}
}
cout<<l<<endl;
}
int main(){
ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
solve();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |