Submission #471589

#TimeUsernameProblemLanguageResultExecution timeMemory
471589dqkRabbit Carrot (LMIO19_triusis)C++17
0 / 100
1 ms204 KiB
#include <bits/stdc++.h> int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); int n, m; std::cin >> n >> m; std::vector<int> a(n + 1, 0); for (int i = 1; i <= n; ++i) { std::cin >> a[i]; } std::vector<bool> ok(n + 1, true); ok[0] = false; int ans = 0; for (int i = 1; i <= n; ++i) { if (a[i] - a[i - 1] > m) { ans++; if (!ok[i - 1]) { a[i] = a[i - 1] + m; ok[i] = false; } } } std::cout << ans << "\n"; 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...