# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
385763 | SansPapyrus683 | Global Warming (CEOI18_glo) | C++17 | 2088 ms | 1132 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <vector>
#include <algorithm>
using std::cout;
using std::endl;
using std::vector;
int find_lis(const vector<int>& a) {
vector<int> dp;
for (int i : a) {
int pos = lower_bound(dp.begin(), dp.end(), i) - dp.begin();
if (pos == dp.size()) // we can have a new, longer increasing subsequence!
dp.push_back(i);
else // oh ok, at least we can make the ending element smaller
dp[pos] = i;
}
return dp.size();
}
int main() {
int temp_num;
int max_cheating;
std::cin >> temp_num >> max_cheating;
vector<int> temps(temp_num);
for (int t = 0; t < temp_num; t++) {
std::cin >> temps[t];
}
int longest = 0;
for (int i = temp_num - 1; i >= 0; i--) {
temps[i] += max_cheating;
longest = std::max(longest, find_lis(temps));
}
cout << longest << endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |