Submission #1048939

#TimeUsernameProblemLanguageResultExecution timeMemory
1048939matereGlobal Warming (CEOI18_glo)C++14
0 / 100
47 ms5712 KiB
#include<bits/stdc++.h> using namespace std; pair<long long,long long>step[200005]; long long a[200005],d[200005],ls; int main(){ long long n,x; cin>>n>>x; d[0]=-2e9-1; for(long long i=1;i<=n;i++){ d[i]=2e9+1; cin>>a[i]; long long l=0,r=n+1; while(l+1<r){ long long mid=(l+r)/2; if(d[mid]<a[i]) l=mid; else r=mid; } l++; if(d[l]>a[i]){ step[i]={l,d[l]}; d[l]=a[i]; ls=max(ls,l); } } d[n+1]=2e9+1; // for(long long i=1;i<=n;i++){ // d[i]=2e9+1; // cin>>a[i]; // long long l=0,r=n+1; // while(l+1<r){ // long long mid=(l+r)/2; // if(d[mid]<a[i]) l=mid; // else r=mid; // } // l++; // if(d[l]>a[i]){ // step[i]={l,d[l]}; // d[l]=a[i]; // } // } cout<<ls<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...