제출 #1030038

#제출 시각아이디문제언어결과실행 시간메모리
1030038AdamGSFinancial Report (JOI21_financial)C++17
48 / 100
4038 ms5976 KiB
#include<bits/stdc++.h> using namespace std; typedef long double ld; typedef long long ll; #define rep(a, b) for(int a = 0; a < (b); ++a) #define st first #define nd second #define pb push_back #define all(a) a.begin(), a.end() const int LIM=3e5+7; int T[LIM], dp[LIM]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, d; cin >> n >> d; rep(i, n) cin >> T[i]; rep(i, n) dp[i]=1; rep(i, n) { int akt=0; for(int j=i+1; j<n; ++j) { ++akt; if(T[j]<=T[i]) akt=0; if(T[j]>T[i]) dp[j]=max(dp[j], dp[i]+1); if(akt==d) break; } } int ans=0; rep(i, n) ans=max(ans, dp[i]); cout << ans << '\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...