Submission #1284337

#TimeUsernameProblemLanguageResultExecution timeMemory
1284337tntRabbit Carrot (LMIO19_triusis)C++20
0 / 100
2 ms572 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define ll long long #define s second #define pb push_back #define f first #define s second const long long inf = 2e9 + 7; const int N = 4e5 + 101; void solve(){ int n,m; cin >> n >> m; int a[n + 1]; a[0] = 0; for(int i = 1; i <= n; i++){ cin >> a[i]; } vector <int> dp(n + 1,-inf); dp[0] = 0; for(int i = 0; i <= n; i++){ for(int j = 0; j < i; j++){ if((i - j) >= (a[i] - a[j]) / m || a[j] >= a[i]){ if(dp[i] < dp[j] + 1){ dp[i] = dp[j] + 1; } } } } int mx = 0; for(int i = 1; i <= n; i++) mx = max(mx,dp[i]); cout << n - mx; } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); //freopen("promote.in", "r", stdin); //freopen("promote.out", "w", stdout); int t = 1; while(t--){ solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...