제출 #419683

#제출 시각아이디문제언어결과실행 시간메모리
419683Sasha008Financial Report (JOI21_financial)C++14
0 / 100
37 ms6784 KiB
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,n,m,g,i,j,k0,k1,k2,k3,f,k,l,r,o,p,t,y,mx=-1e18,mx1=-1e18,mx2=-1e18,q,q1,q2,mn=1e18,mn1=1e18,mn2=1e18,INF=1e18;
long long A[200005];
long long dp[200005];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>d;
    for(i=1;i<=n;i++)
    {
        cin>>A[i];
        dp[i]=1;
    }
    for(i=1;i<=n;i++)
    {
        if (n<=7000||d==1)
        {
            f=max(a-a+1,i-d);
            mx2=-1e18;
            for(j=i-1;j>=f;j--)
            {
                if (A[i]>A[j]) mx2=max(mx2,dp[j]);
                else mx2=max(mx2,dp[j]-1);
            }
            if (mx2>=0) dp[i]+=mx2;
            mx=max(mx,dp[i]);
        }
        else
        {

        }
    }
    cout<<mx;
}
//10 1
//1 1 2 2 2 2 2 2 3 3

//numeric_limits<long long>::3min()
#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...