Submission #910046

#TimeUsernameProblemLanguageResultExecution timeMemory
910046KactusJackRabbit Carrot (LMIO19_triusis)C++14
0 / 100
1 ms856 KiB
#include<bits/stdc++.h> #define ll long long #define F first #define S second using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; vector<int> a(n+1); for(int i = 1; i <= n; i++){ cin >> a[i]; } int ans = 0; vector<bool> edited(n+1); edited[0] = 1; for(int i = 1; i <= n; i++){ if(a[i] - a[i-1] <= m){ continue; } ans++; if(!edited[i-1]){ edited[i-1] = 1; a[i-1] = a[i]; } else{ edited[i] = 1; a[i] = a[i-1] + m; } } cout << ans << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...