# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
416200 | 2021-06-02T07:09:19 Z | duyanh1704 | Global Warming (CEOI18_glo) | C++14 | 49 ms | 6120 KB |
#include <bits/stdc++.h> using namespace std; const int inf = 2e9 + 29; int n, x, res; vector<int> a; vector<int> LIS(vector<int> a, int k){ vector<int> f(n + 5, inf); f[0] = -inf; vector<int> dp(n, 0); f[0] = -inf; for (int i = 0; i < n; ++i){ int k = lower_bound(f.begin(), f.end(), k * a[i]) - f.begin(); if (i > 0) dp[i] = k; else dp[i] = k; f[k] = k * a[i]; } return dp; } int main(){ ios::sync_with_stdio(0); cin.tie(0); cin >> n >> x; for (int i = 1; i <= n; ++i){ int t; cin >> t; a.push_back(t); } vector<int> f = LIS(a, 1); reverse(a.begin(), a.end()); vector<int> g = LIS(a, -1); reverse(g.begin(), g.end()); for (int i = 0; i < n; ++i) res = max(res, f[i] + g[i] - 1); cout << res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 204 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 204 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 204 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 49 ms | 6120 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 15 ms | 1784 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 24 ms | 3132 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 204 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |