Submission #829494

#TimeUsernameProblemLanguageResultExecution timeMemory
829494GithubRabbit Carrot (LMIO19_triusis)C++14
0 / 100
1 ms212 KiB
#include <iostream> #include <vector> #include <map> #include <set> #include <queue> #include <iterator> #include <deque> #include <cmath> #include <cstring> #include <climits> #include <algorithm> using namespace std; typedef long long ll; ll minLIS(vector<ll> &a, ll st){ multiset<ll> s; s.insert(0); ll ans = 1; auto cur = s.begin(); for (ll u: a){ auto it = s.lower_bound(u-st); if (it != s.end()){ bool flag = false; if (it == cur){ ans++; flag = true; } s.erase(it); s.insert(u); if (flag) { cur = s.find(u); } }else{ s.insert(u); } } return ans; } int main() { ll n, m; cin >> n >> m; vector<ll> a(n); for (int i = 0; i < n; i++){ cin >> a[i]; } cout << n+1-minLIS(a, m) << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...