# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
259889 | Kenzo_1114 | Global Warming (CEOI18_glo) | C++17 | 2098 ms | 1860 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 200010;
const int INF = 2e9 + 9;
int n, x, t[MAXN], dp[MAXN];
int calc()
{
for(int i = 0; i < n; i++) dp[i] = INF;
int mx = 0;
for(int i = 0; i < n; i++)
{
int it = lower_bound(dp, dp + n, t[i]) - dp;
dp[it] = t[i];
mx = max(mx, it);
}
return mx + 1;
}
int main ()
{
scanf("%d %d", &n, &x);
for(int i = 0; i < n; i++) scanf("%d", &t[i]);
int ans = 0;
for(int i = 0; i < n; i++)
{
t[i] -= x;
ans = max(ans, calc());
}
printf("%d\n", ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |