Submission #638889

#TimeUsernameProblemLanguageResultExecution timeMemory
638889luanaamorimFinancial Report (JOI21_financial)C++14
0 / 100
4059 ms5172 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, 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); } 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...