제출 #750619

#제출 시각아이디문제언어결과실행 시간메모리
750619dmotRabbit Carrot (LMIO19_triusis)C++17
0 / 100
1 ms340 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using pi = pair<int, int>; int main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); int n; cin >> n; ll m; cin >> m; vector<ll> a(n+1); for (int i = 1; i <= n; ++i) cin >> a[i]; vector<ll> dp(n+1, -1e7); dp[0] = 0; int fixed = 0; int last = 0; for (int i = 1; i <= n; ++i) { if (a[i] <= last + m) { // this one can stay like that as well fixed++; last = a[i]; } else { last += m; } // cerr << "i : " << i << " fixed : " << fixed << endl; } // for (auto x : dp) cerr << x << " "; // cerr << endl; // int i = 0; // for (; i <= n; ++i) { // if (dp[i] < 0) break; // } // i--; // cout << (n - i) << endl; cout << n - fixed << endl; 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...