Submission #654188

#TimeUsernameProblemLanguageResultExecution timeMemory
654188Mohammad_ParsaFinancial Report (JOI21_financial)C++14
5 / 100
56 ms3980 KiB
#include<bits/stdc++.h> using namespace std; //#define int long long #define ll long long #define F first #define S second #define pb push_back const int N=3e5+7; int dp[N],v[N],a[N]; map<int,int> mp; vector<int> vec; int main(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); int n,d; cin>>n>>d; for(int i=0;i<n;i++){ cin>>a[i];vec.pb(a[i]); } /*sort(vec.begin(),vec.end()); vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end()))); for(int i=0;i<vec.size();i++){ v[i]=vec[i]; mp[vec[i]]=i; }*/ fill(dp,dp+N,1e9+7); int ans=0; dp[0]=-1; for(int i=0;i<n;i++){ int l=0,r=ans+1; while(r-l>1){ int m=(l+r)/2; if(dp[m]>=a[i]) r=m; else l=m; } dp[l+1]=min(dp[l+1],a[i]); if(l==ans) ans++; } cout<<ans; }
#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...