제출 #1309226

#제출 시각아이디문제언어결과실행 시간메모리
1309226nguyenkhangninh99Rabbit Carrot (LMIO19_triusis)C++20
0 / 100
2 ms584 KiB
#include<bits/stdc++.h>
using namespace std;

#define int long long
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
	int n, h; cin >> n >> h;

	vector<int> b;
	for(int i = 1; i <= n; i++){
        int d; cin >> d;
		if(i * h >= d){
            int x = i * h - d;
            if(b.empty() || x > b.back()) b.push_back(x);
		    else b[upper_bound(b.begin(), b.end(), x) - b.begin()] = x;
        }
	}
    cout << n - b.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...