제출 #483753

#제출 시각아이디문제언어결과실행 시간메모리
483753duchungFinancial Report (JOI21_financial)C++17
0 / 100
4070 ms2624 KiB
#pragma GCC optimize("O3") #pragma GCC target("avx,avx2,fma") #pragma GCC optimize("unroll-loops") #include<bits/stdc++.h> using namespace std; const int N = 3e5 + 5; int n , d; int a[N]; int dp[N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> d; for (int i = 1 ; i <= n ; ++i) cin >> a[i]; for (int i = 1 ; i <= n ; ++i) { dp[i] = 1; for (int j = i - 1 ; j >= max(i - d , 1) ; --j) { if (a[i] > a[j]) dp[i] = max(dp[i] , dp[j] + 1); } } int ans = 0; for (int i = 1 ; i <= n ; ++i) ans = max(ans , dp[i]); cout << ans; }
#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...