제출 #1229033

#제출 시각아이디문제언어결과실행 시간메모리
1229033free_de_la_zenithRabbit Carrot (LMIO19_triusis)C++20
0 / 100
1 ms584 KiB
/**
 *    author:  MINHTPC
 *
**/
#include <bits/stdc++.h>

#define ll long long
#define fi first
#define se second
#define pb push_back
#define all(a) a.begin() , a.end()
#define FOR(i ,a , b) for(int i = a ; i <= b ; ++i)
#define bit(mask,i) ((mask>>i)&1)
#define name "task"
#define lo lower_bound
#define up upper_bound
#define count_bit1(x) __builtin_popcountll(x)
#define count_bit01(x) __builtin_clzll(x)
#define count_bit10(x) __builtin_ctzll(x)

using namespace std;
const int N=2e5+5;
long long a[N],e[N];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int n,MAX;
    cin >> n >> MAX;
    int m=0;
    for(int i=1;i<=n;i++) cin >> a[i];
    for(int i=1;i<=n;i++) {
        if(a[i]<=MAX*i) {
            e[++m]=MAX*i-a[i];
        }
    }
    vector<ll>res;
    for(int i=1;i<=m;i++) {
        auto it=upper_bound(all(res),e[i]);
        if(it==res.end()) res.push_back(e[i]);
    }
    cout << n-res.size();
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...