Submission #1156709

#TimeUsernameProblemLanguageResultExecution timeMemory
1156709domblyFinancial Report (JOI21_financial)C++20
48 / 100
4091 ms4936 KiB
#include <bits/stdc++.h> #define F first #define S second #define pb push_back #define int long long using namespace std; const int N = 3e6 + 10; const int inf = 1e8; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n,d; cin >> n >> d; vector<int>a(n + 1),dp(n + 1,1); for(int i = 1; i <= n; i++) cin >> a[i]; for(int i = 1; i <= n; i++) { int c = 1; for(int j = i - 1; j >= 1; j--) { if(c > d) break; if(a[i] > a[j]) dp[i] = max(dp[i],dp[j] + 1),c = 1; else c++; } } int ans = 0; for(int i = 1; i <= n; i++) ans = max(ans,dp[i]); cout << ans; return 0; }
#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...