Submission #654120

#TimeUsernameProblemLanguageResultExecution timeMemory
654120mhn2Financial Report (JOI21_financial)C++17
48 / 100
4078 ms2092 KiB
#include <bits/stdc++.h> #define ll long long #define pii pair<int, int> #define pll pair<ll, ll> #define F first #define S second using namespace std; const int N = 3e5+5; int n, d; int a[N], dp[N]; void input() { cin >> n >> d; for (int i = 0; i < n; i++) cin >> a[i]; } void solve1() { int ans = 0; for (int i = n-1; i > -1; i--) { int t = 0; for (int j = i+1; j < n; j++) { if (a[j] <= a[i]) { t = 0; continue; } t++; dp[i] = max(dp[i], dp[j]); if (t == d) break; } dp[i]++; ans = max(ans, dp[i]); } cout << ans << endl; } void solve2() { } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); input(); solve1(); }
#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...