# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
129009 | 2019-07-11T12:22:06 Z | arnold518 | Cloud Computing (CEOI18_clo) | C++14 | 2 ms | 376 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 2e5; const int INF = numeric_limits<int>::max(); int N, X, A[MAXN+10]; int lis[MAXN+10], lds[MAXN+10], ans; pii change[MAXN+10]; int main() { int i, j; scanf("%d%d", &N, &X); for(i=1; i<=N; i++) scanf("%d", &A[i]); for(i=1; i<=N; i++) lis[i]=INF; for(i=1; i<=N; i++) { int it=lower_bound(lis+1, lis+N+1, A[i])-lis; change[i]={it, lis[it]}; lis[it]=A[i]; ans=max(ans, it); } for(i=N; i>=1; i--) { int it=lower_bound(lds+1, lds+N+1, A[i]+X, greater<int>())-lds; lds[it]=A[i]+X; lis[change[i].first]=change[i].second; int jt=lower_bound(lis+1, lis+N+1, A[i]+X)-lis-1; ans=max(ans, it+jt); } printf("%d", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |