Submission #797144

# Submission time Handle Problem Language Result Execution time Memory
797144 2023-07-29T07:18:30 Z yusuf12360 Rabbit Carrot (LMIO19_triusis) C++14
0 / 100
1 ms 212 KB
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n, m; cin >> n >> m;
	vector<int> a(n+1), dp;
	for(int i=n-1; i>=0; i--) cin >> a[i];
	for(int i=0; i<=n; i++) {
		auto it=lower_bound(dp.begin(), dp.end(), a[i]+m);
		if(it==dp.end()) dp.push_back(a[i]);
		else *it=a[i];
	}
	cout << n-(int)dp.size() << '\n';
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -