Submission #422990

#TimeUsernameProblemLanguageResultExecution timeMemory
422990MKopchevFinancial Report (JOI21_financial)C++14
48 / 100
4094 ms2620 KiB
#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)

Main.cpp: In function 'int main()':
Main.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%i%i",&n,&d);
      |     ~~~~~^~~~~~~~~~~~~~
Main.cpp:14:31: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     for(int i=1;i<=n;i++)scanf("%i",&inp[i]);
      |                          ~~~~~^~~~~~~~~~~~~~
#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...