Submission #573201

#TimeUsernameProblemLanguageResultExecution timeMemory
573201Dan4LifeFinancial Report (JOI21_financial)C++17
0 / 100
4088 ms5124 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int LINF = (int)1e18; int n, d, dp[300010], a[300010]; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> d; for(int i = 0; i < n; i++) cin >> a[i]; fill(dp, dp+n, 1); set<int> S; S.insert(a[0]); for(int i = n-2; i >= 0; i--){ for(int j = i+1; j<=min(n-1,i+d); j++){ if(a[j]>a[i]) dp[i] = max(dp[i], dp[j]+1); } S.insert(a[i]); } //for(int i = 1; i <= n; i++) cout << dp[i-1] << " "; cout << "\n"; cout << *max_element(dp, dp+n); }
#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...