# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1000019 | daffuwu | Global Warming (CEOI18_glo) | C++14 | 2093 ms | 3132 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;
#define fr first
#define sc second
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int n, x, t[200069], ans, dp[200069][2];
int main()
{
int i, j;
scanf("%d%d", &n, &x);
for (i=1; i<=n; i++)
{
scanf("%d", t+i);
for (j=0; j<=i-1; j++)
{
if (t[j]<t[i])
{
dp[i][0] = max(dp[i][0], dp[j][0]+1);
dp[i][1] = max(dp[i][1], dp[j][1]+1);
}
if (t[j]-x<t[i]) dp[i][1] = max(dp[i][1], dp[j][0]+1);
}
ans = max(ans, max(dp[i][0], dp[i][1]));
}
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... |