# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
997677 | akamizane | Rabbit Carrot (LMIO19_triusis) | C++17 | 31 ms | 35676 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// brute f0rce spammer
#include<bits/stdc++.h>
using namespace std;
typedef pair<long long,long long> pii;
#define int long long
#define el cout << '\n'
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define debug(f,n) for (int i = 0; i < n; i++){cout << f[i] << " ";} el;
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FOD(i, a, b) for (int i = (a); i >= (b); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define maxn 4003
#define mod 998244353
template <class T1, class T2>bool maximize(T1 &a, T2 b){if (a < b) {a = b; return true;}return false;}
template <class T1, class T2>bool minimize(T1 &a, T2 b){if (a > b) {a = b; return true;}return false;}
vector<vector<bool>> vis;
vector<vector<char>> x;
int minr, maxr, minc, maxc, cnt;
int m, n;
void solve(){
int n, k;
cin >> n >> k;
vector<int> x(n);
REP(i, n) cin >> x[i];
int cnt = 0, now = 0;
REP(i, n){
if (now + k < x[i]){
x[i] = now + k;
cnt++;
}
now = x[i];
}
cout << cnt;
}
signed main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int q = 1;
//cin >> q;
while(q--){
solve();
el;
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |