# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
69919 | MatheusLealV | Long Mansion (JOI17_long_mansion) | C++17 | 3047 ms | 18804 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>
#define N 500050
using namespace std;
int n, q, c[N], L[N], R[N];
int e[N];
vector<int> pos[N];
void solve(int l, int r, int i)
{
while(true)
{
L[i] = l;
R[i] = r;
bool ok = false;
if(r < n)
{
int q = upper_bound(pos[c[r]].begin(), pos[c[r]].end(), r) - lower_bound(pos[c[r]].begin(), pos[c[r]].end(), l);
if(q) r = max(r + 1, R[r]), ok = 1;//solve(l, max(r + 1, R[r]), i), ok = 1;
}
if(l > 1 and !ok)
{
int q = upper_bound(pos[c[l - 1]].begin(), pos[c[l - 1]].end(), r) - lower_bound(pos[c[l - 1]].begin(), pos[c[l - 1]].end(), l);
# | 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... |