# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
49421 | SpaimaCarpatilor | City (JOI17_city) | C++17 | 584 ms | 55280 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 "Encoder.h"
#include<bits/stdc++.h>
using namespace std;
const int maxN = 250002;
int nr = 0, l[250009], r[250009];
vector < int > v[250009];
void dfs (int nod, int tata)
{
l[nod] = ++nr;
for (auto it : v[nod])
if (it != tata)
dfs (it, nod);
r[nod] = nr;
}
void Encode (int N, int A[], int B[])
{
for (int i=0; i<N; i++)
v[A[i]].push_back (B[i]),
v[B[i]].push_back (A[i]);
dfs (0, -1);
for (int i=0; i<N; i++)
Code(i, 1LL * l[i] * maxN + r[i]);
}
#include "Device.h"
#include<bits/stdc++.h>
using namespace std;
const int maxN = 250002;
void InitDevice()
{
}
int Answer (long long S, long long T)
{
long long lS = S / maxN, rS = S % maxN;
long long lT = T / maxN, rT = T % maxN;
if (lT <= lS && rS <= rT) return 0;
if (lS <= lT && rT <= rS) return 1;
return 2;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |