# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
318535 | mohamedsobhi777 | City (JOI17_city) | C++14 | 202 ms | 28880 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 = 3e5;
using namespace std;
vector<int> adj[MAX];
int st[MAX], en[MAX], T;
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, st[x] * 1000000 + 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"
void InitDevice()
{
}
int Answer(long long S, long long T)
{
int s1 = S / 1000000, t1 = S % 1000000;
int s2 = T / 1000000, t2 = T % 1000000;
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... |