Submission #829486

#TimeUsernameProblemLanguageResultExecution timeMemory
829486GithubRabbit 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; int minLIS(vector<int> a, int st){ set<int> s; s.insert(0); int ans = 1; auto cur = s.begin(); for (int 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() { int n, m; cin >> n >> m; vector<int> 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...