# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
422990 | MKopchev | Financial Report (JOI21_financial) | C++14 | 4094 ms | 2620 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;
const int nmax=3e5+42;
int n,d,inp[nmax];
int dp[nmax];
int main()
{
scanf("%i%i",&n,&d);
for(int i=1;i<=n;i++)scanf("%i",&inp[i]);
int outp=0;
for(int i=1;i<=n;i++)
{
dp[i]=1;
int cnt=0;
for(int j=i-1;j>=1&&cnt<d;j--)
{
if(inp[i]<=inp[j])cnt++;
else
{
cnt=0;
dp[i]=max(dp[i],dp[j]+1);
}
}
outp=max(outp,dp[i]);
//cout<<i<<" -> "<<dp[i]<<endl;
}
printf("%i\n",outp);
return 0;
}
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... |