Submission #1164663

#TimeUsernameProblemLanguageResultExecution timeMemory
1164663Sir_Ahmed_ImranRabbit Carrot (LMIO19_triusis)C++17
0 / 100
34 ms328 KiB
// 01001100 01001111 01010100 01000001 \\ // \\ // ╦ ╔═╗╔╦╗╔═╗ \\ // ║ ║ ║ ║ ╠═╣ \\ // ╩═╝╚═╝ ╩ ╩ ╩ \\ // \\ // 01001100 01001111 01010100 01000001 \\ #include <bits/stdc++.h> using namespace std; #define N 200001 #define nl '\n' #define ff first #define ss second #define add insert #define ll long long #define ld long double #define terminator main #define pll pair<ll,ll> #define append push_back #define pii pair<int,int> #define all(x) (x).begin(),(x).end() #define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) ll a[N]; ll dp[N]; void solve(){ ll n, m, ans; cin >> n >> m; ans = n; for(ll i = 1; i <= n; i++){ cin >> a[i]; dp[i] = n; for(ll j = 0; j < i; j++) if(a[i] - a[j] <= (i - j) * m && dp[j] < n) dp[i] = dp[j] + i - j - 1; ans = min(ans, dp[i] + n - i); } cout << ans; } int terminator(){ L0TA; solve(); 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...