# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
654174 | Mohammad_Parsa | Financial Report (JOI21_financial) | C++14 | 85 ms | 4164 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
dp[mp[a[0]]]=1;
for(int i=1;i<n;i++){
dp[mp[a[i]]]=max(1,dp[mp[a[i]]]);
if(a[i]>a[i-1]) dp[mp[a[i]]]=max(dp[mp[a[i]]],dp[mp[a[i-1]]]+1);
}
int ans=0;
for(int i=0;i<vec.size();i++){
ans=max(ans,dp[i]);
}
cout<<ans;
}
Compilation message (stderr)
# | 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... |