# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1104165 | 2024-10-23T04:57:15 Z | vjudge1 | Global Warming (CEOI18_glo) | C++17 | 36 ms | 3940 KB |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 3; int ar[N]; int main() { cin.tie(nullptr)->sync_with_stdio(false); int n, x; cin >> n >> x; for(int i=1; i<=n; ++i) cin >> ar[i]; int res = 1; int dp[n+1]; dp[0] = 0; vector<int> lis; for(int i=1; i<=n; ++i) { auto t = lower_bound(lis.begin(), lis.end(), ar[i]); if(t == lis.end()) lis.emplace_back(ar[i]); else *t = ar[i]; dp[i] = lis.size(); } res = lis.size(); lis.clear(); for(int i=n; i>=1; --i) { int x = lower_bound(lis.begin(), lis.end(), -ar[i] + x) - lis.begin(); if(x == lis.size()) lis.emplace_back(-ar[i] + x); else lis[x] = -ar[i] + x; res = max(res, dp[i-1] + (int)lis.size()); } cout << res << '\n'; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Incorrect | 1 ms | 336 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Incorrect | 1 ms | 336 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Incorrect | 1 ms | 336 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 33 ms | 1872 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 848 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 1104 KB | Output is correct |
2 | Correct | 18 ms | 2060 KB | Output is correct |
3 | Correct | 36 ms | 3940 KB | Output is correct |
4 | Incorrect | 19 ms | 3796 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Incorrect | 1 ms | 336 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |