# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
318545 | mohamedsobhi777 | City (JOI17_city) | C++14 | 509 ms | 47372 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>
#include "Encoder.h"
const int MAX = 5e5;
using namespace std;
vector<int> adj[MAX];
long long st[MAX], en[MAX], T;
const int L = 250000 + 1 ;
void dfs(int x, int p)
{
st[x] = ++T;
for (auto u : adj[x])
{
if (u == p)
continue;
dfs(u, x);
}
en[x] = ++T;
Code(x, 1ll * st[x] * L + en[x]);
}
void Encode(int N, int A[], int B[])
{
for (int i = 0; i < N - 1; ++i)
{
adj[A[i]].push_back(B[i]);
adj[B[i]].push_back(A[i]);
}
dfs(0, 0);
}
#include "Device.h"
const int L = 250000 + 1 ;
void InitDevice()
{
}
int Answer(long long S, long long T)
{
long long s1 = S / L, t1 = S % L;
long long s2 = T / L, t2 = T % L;
if(s2>= s1 && t2 <= t1)return 1;
if(s1 >= s2 && t1 <= t2) return 0;
return 2;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |