# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
416202 | 2021-06-02T07:11:26 Z | duyanh1704 | Global Warming (CEOI18_glo) | C++14 | 51 ms | 8120 KB |
#include <bits/stdc++.h> #define int long long using namespace std; const int inf = 1e17 + 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(); dp[i] = k; f[k] = k * a[i]; } return dp; } signed 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
# | 결과 | 실행 시간 | 메모리 | 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 | - |
# | 결과 | 실행 시간 | 메모리 | 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 | - |
# | 결과 | 실행 시간 | 메모리 | 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 | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 51 ms | 8120 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 12 ms | 2268 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 26 ms | 4228 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | 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 | - |