제출 #738854

#제출 시각아이디문제언어결과실행 시간메모리
738854veehjFinancial Report (JOI21_financial)C++17
28 / 100
4093 ms1048576 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define F first #define S second #define pb push_back #define sz(a) (int)a.size() #define pll pair<ll, ll> #define all(x) (x).begin(), (x).end() int main() { ll n, d; cin >> n >> d; vector<ll> a(n); for(auto& u : a) cin >> u; vector<map<ll, ll>> mp(n); //v[place][max]=ans mp[0][a[0]]=1; for(ll i=1; i<n; i++){ mp[i][a[i]]=1; for(ll j=1; j<=d; j++){ if(i>=j){ for(auto& u : mp[i-j]){ if(u.F>=a[i]){ mp[i][u.F]=max(mp[i][u.F], u.S); } else{ mp[i][a[i]]=max(mp[i][a[i]], u.S+1); } } } } } ll ans=0; for(auto& u : mp[n-1]) ans=max(ans, u.S); cout << ans << 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...