# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
374888 | peijar | Xylophone (JOI18_xylophone) | C++17 | 147 ms | 40940 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 "xylophone.h"
#include <bits/stdc++.h>
#define int long long
using namespace std;
static int A[5001];
static bool isLess[5001][5001];
static int queries[5001][5001];
// On a |a[i+1] - a[i]|, |a[i+2] - a[i+1]|, max(...)
// a[i] < a[i+2] < a[i+1] : z = x
// a[i+1] < a[i+2] < a[i] : z = x
//
// a[i+1] < a[i] < a[i+2] : z = y
// a[i+2] < a[i] < a[i+1] : z = y
// a[i+2] < a[i+1] < a[i] : z > x,y
// a[i] < a[i+1] < a[i+2] : z > x,y
void solve(signed N)
{
isLess[1][2] = true;
for (int i(1); i < N; ++i)
queries[i][i+1] = query(i,i+1);
for (int i(1); i < N-1; ++i)
queries[i][i+2] = query(i, i+2);
for (int i(1); i+2 <= N; ++i)
{
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |