# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
46922 | SpaimaCarpatilor | Ancient Books (IOI17_books) | C++17 | 1037 ms | 249660 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 "books.h"
#include<bits/stdc++.h>
using namespace std;
int nr, N, BG, p[1000009], d[1000009], mars[1000009];
set < int > S;
vector < int > v[1000009];
void add (int node, int newD)
{
if (d[node] != -1) return ;
d[node] = newD, v[newD].push_back (node), S.erase (node);
int l = node, r = p[node];
if (l > r) swap (l, r);
while (1)
{
auto it = S.lower_bound (l);
if (it == S.end () || *it > r) break;
add (*it, newD);
}
}
long long minimum_walk (vector < int > pp, int ss)
{
N = pp.size (), BG = ss + 1;
for (int i=1; i<=N; i++)
p[i] = pp[i - 1] + 1;
long long ans = 0;
int x = 0, y = 0;
# | 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... |