Submission #638893

#TimeUsernameProblemLanguageResultExecution timeMemory
638893luanaamorimFinancial Report (JOI21_financial)C++14
0 / 100
4042 ms4988 KiB
#include <bits/stdc++.h> #define MAX (int)(1e6 + 5) #define ll long long #define esq(x) (x<<1) #define dir(x) ((x<<1)|1) using namespace std; int n, k; ll h[MAX], dp[MAX], resp; int main() { cin >> n >> k; for (int i = 1; i <= n; i++) { cin >> h[i]; dp[i] = 1; } for (int i = 1; i <= n; i++) { for (int j = max(1, i-k); j < i; j++) { if (h[j]<h[i]) dp[i] = max(dp[i], dp[j]+1); else if (h[i]==h[j]) dp[i] = max(dp[i], dp[j]); } resp = max(resp, dp[i]); } cout << resp << endl; }
#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...