Submission #1077958

#TimeUsernameProblemLanguageResultExecution timeMemory
1077958abdelhakimFinancial Report (JOI21_financial)C++14
48 / 100
4067 ms8272 KiB
#include <bits/stdc++.h> #define mod 1000000007LL #define inf 1e17 #define ll long long using namespace std; void printvec(vector<ll> vec) { for (auto &&e : vec) { cout << e << ' '; } cout << endl; } int main() { ios::sync_with_stdio(false); cin.tie(0); ll n, d; cin >> n>> d; vector<ll> a(n); for(int i=0; i < n; i++) cin >> a[i]; vector<ll> dp(n,1); dp.back() = 1; for (int i = n-2; i >= 0; i--) { ll cur = 0; for (int j=i+1; j < n; j++) { if(a[j] > a[i]) { cur++; dp[i] = max(dp[i], 1 + dp[j]); if(cur == d)break; } else cur = 0; } } cout << *max_element(dp.begin(), dp.end()) << 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...