# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
169993 | 2019-12-23T14:19:12 Z | mhy908 | Global Warming (CEOI18_glo) | C++14 | 43 ms | 3660 KB |
#include <bits/stdc++.h> #define pb push_back using namespace std; typedef long long LL; const LL llinf=9000000000000000000; int n; LL x, arr[200010]; vector<LL> lis, lds; int dplis[200010], dplds[200010], ans; LL minlds[200010]; int main() { scanf("%d %lld", &n, &x); for(int i=1; i<=n; i++)scanf("%lld", &arr[i]); for(int i=n; i>=1; i--){ auto it=lower_bound(lds.begin(), lds.end(), -arr[i]); if(lds.back()<-arr[i])lds.pb(-arr[i]); else *it=-arr[i]; dplds[i]=lds.size(); minlds[i]=-lds[dplds[i]-1]; } minlds[n+1]=llinf; for(int i=1; i<=n; i++){ auto it=lower_bound(lis.begin(), lis.end(), arr[i]); if(lis.back()<arr[i])lis.pb(arr[i]); else *it=arr[i]; dplis[i]=lower_bound(lis.begin(), lis.end(), minlds[i+1]+x)-lis.begin(); } ans=dplds[1]; for(int i=1; i<n; i++){ ans=max(ans, dplis[i]+dplds[i+1]); } printf("%d", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 504 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 504 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 504 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 43 ms | 3660 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 13 ms | 1272 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 22 ms | 2040 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 504 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |