Submission #1221894

#TimeUsernameProblemLanguageResultExecution timeMemory
1221894spetrFinancial Report (JOI21_financial)C++20
0 / 100
515 ms1114112 KiB
#include <bits/stdc++.h> #include <algorithm> using namespace std; #define ll long long const ll mmod = 998244353; #define vl vector<long long> #define vll vector<vector<long long>> int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); ll n, d; cin >> n >> d; vl nums; for (ll i = 0; i < n; i++){ ll num; cin >> num; nums.push_back(num); } vll dp(n+1, vl(n, 10e6)); for(ll i = 0; i < n; i++) dp[1][i] = nums[i]; for(ll i = 0; i < n; i++){ for(ll k = 2; k <= n; k++){ ll best = 10e6; ll nula = 0; ll lo = max(nula, i - d); for(ll t = lo; t < i; t++){ best = min(best, dp[k][t]); } for(ll t = lo; t < i; t++){ if (dp[k-1][t] < nums[i]) best = min(best, nums[i]); } dp[k][i] = best; } } ll skore = 1; for(ll k = 1; k <= n; k++){ if (dp[k][n-1] < 10e6) skore = k; } cout << skore << "\n"; 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...