Submission #1195369

#TimeUsernameProblemLanguageResultExecution timeMemory
1195369marcus06Global Warming (CEOI18_glo)C++20
28 / 100
2095 ms1092 KiB
#include <bits/stdc++.h> using namespace std; using lli = long long; #ifdef LOCAL #include </home/marcus06/mycp/Library/debug.h> #else #define debug(...) #endif int lis(vector <int> &a) { vector <int> L; for (auto &x: a) { auto it = lower_bound(L.begin(), L.end(), x); if (it == L.end()) { L.push_back(x); } else { *it = x; } } return int(L.size()); } void solve() { int n, x; cin >> n >> x; vector <int> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } int ans = lis(a); for (int i = 0; i < n; ++i) { a[i] -= x; ans = max(ans, lis(a)); } cout << ans << '\n'; } int main() { std::cin.tie(0)->sync_with_stdio(0); #ifdef LOCAL auto begin = std::chrono::high_resolution_clock::now(); #endif int tt = 1; while (tt--) { solve(); } #ifdef LOCAL auto end = std::chrono::high_resolution_clock::now(); auto elapsed = std::chrono::duration_cast<std::chrono::nanoseconds>(end - begin); std::cerr << "Time measured: " << elapsed.count() * 1e-9 << " seconds.\n"; #endif 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...