This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef pair<ll, ll> pll;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define ROF(i,a,b) for (int i = a; i >=b; i--)
#define pb push_back
#define ms memset
#define F first
#define S second
ll MOD = 1000000007;
//ll MOD = 998244353
ll power(ll base, ll n){
if (n == 0) return 1;
if (n == 1) return base;
ll halfn = power(base, n/2);
if (n % 2 == 0) return (halfn*halfn) % MOD;
return (((halfn*halfn)%MOD)*base) % MOD;
}
ll inverse(ll n){
return power(n, MOD-2);
}
ll add(ll a, ll b){
return (a+b) % MOD;
}
ll mul(ll a, ll b){
return (a*b) % MOD;
}
ll gcd(ll a, ll b){
if (a == 1) return 1;
if (a == 0) return b;
return gcd(b%a, a);
}
int main(){
ios::sync_with_stdio(false);
int n, m; cin >> n >> m;
vi a(n+1);
FOR(i, 1, n+1) cin >> a[i];
FOR(i, 1, n+1) a[i] -= m*i;
int ans = 0;
FOR(i, 1, n+1){
if (a[i] > a[i-1]){
a[i] = a[i-1];
ans++;
}
}
cout << ans << '\n';
}
# | 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... |