Submission #882116

#TimeUsernameProblemLanguageResultExecution timeMemory
882116skywwlaGlobal Warming (CEOI18_glo)C++17
0 / 100
28 ms4696 KiB
#include <bits/stdc++.h> using namespace std ; using ll = long long ; const int N = 2e5 + 5 ; int n , x , a[N], l[N], r[N] ; int findLIS() { vector<int> d ; for (int i = 1 ; i <= n ; i++) { auto it = upper_bound(d.begin(), d.end(), a[i]) ; if (it == d.end()) d.push_back(a[i]) ; else *it = a[i] ; } return d.size() ; } int32_t main() { ios::sync_with_stdio(false) ; cin.tie(nullptr) ; cin >> n >> x ; for (int i = 1 ; i <= n ; i++) { cin >> a[i] ; } for (int i = 1 ; i <= n ; i++) { l[i] = a[i] - x ; r[i] = a[i] + x ; } cout << findLIS() ; 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...