Submission #1013429

#TimeUsernameProblemLanguageResultExecution timeMemory
1013429ThunnusRabbit Carrot (LMIO19_triusis)C++17
0 / 100
0 ms348 KiB
#include<bits/stdc++.h> using namespace std; using i64 = long long; #define int i64 #define vi vector<int> #define vvi vector<vi> #define vb vector<bool> #define pii pair<int, int> #define fi first #define se second #define sz(x) (int)(x).size() signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n, m, ans = 0, last = 0; cin >> n >> m; vi h(n); for(int &i : h) cin >> i; if(h[0] > m){ h[0] = m; ans++; for(int i = 0; i < n - 1; i++){ if(h[i + 1] - h[i] > m){ ans++; h[i + 1] = h[i] + m; } } } for(int i = last; i < n - 1; i++){ if(h[i + 1] - h[i] > m){ ans++; } } cout << ans; 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...