Submission #654191

#TimeUsernameProblemLanguageResultExecution timeMemory
654191Mohammad_ParsaFinancial Report (JOI21_financial)C++14
0 / 100
43 ms5120 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],mn[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; }*/ dp[n-1]=1; mn[n-1]=a[n-1]; int ans=1; for(int i=n-2;i>=0;i--){ mn[i]=min(mn[i+1],a[i]); dp[i]=1; if(a[i]<mn[i+1]) dp[i]=max(dp[i],dp[i+1]+1); else dp[i]=max(dp[i],dp[i+1]); ans=max(ans,dp[i]); } 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...