# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1103957 | 2024-10-22T12:57:47 Z | vjudge1 | Global Warming (CEOI18_glo) | C++17 | 24 ms | 3284 KB |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 1; const int INF = 2e9; int arr[N] , ans; int l[N] , r[N]; vector<int> dp; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n,x; cin >> n >> x; for (int i=1;i<=n;i++) cin >> arr[i]; for (int i=1;i<=n;i++) { int idx = lower_bound(dp.begin(), dp.end(), arr[i]) - dp.begin(); l[i] = idx + 1; if (idx==dp.size()) dp.push_back(arr[i]); dp[idx] = arr[i]; } dp.clear(); for(int i=n;i>=1;i--) { int idx = lower_bound(dp.begin(), dp.end(), -arr[i] + x) - dp.begin(); r[i] = idx + 1; if (idx==dp.size()) dp.push_back(arr[i]); dp[idx] = arr[i]; } int ans = 0; for (int i=1;i<=n;i++) ans = max(ans, l[i] + r[i] - 1); cout << ans; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 2640 KB | Output is correct |
2 | Correct | 23 ms | 2776 KB | Output is correct |
3 | Correct | 24 ms | 2640 KB | Output is correct |
4 | Correct | 24 ms | 2632 KB | Output is correct |
5 | Correct | 17 ms | 3284 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 2640 KB | Output is correct |
2 | Correct | 8 ms | 2640 KB | Output is correct |
3 | Correct | 7 ms | 2640 KB | Output is correct |
4 | Incorrect | 5 ms | 2896 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 17 ms | 2896 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |