# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
67270 | ikura355 | City (JOI17_city) | C++14 | 536 ms | 60680 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;
#define ll long long
const int maxn = 250000 + 5;
int n;
vector<int> way[maxn];
ll cur, st[maxn], ft[maxn];
void dfs(int u, int last) {
st[u] = ++cur;
for(auto v : way[u]) {
if(v==last) continue;
dfs(v,u);
}
ft[u] = cur;
}
void Encode(int N, int A[], int B[]) {
n = N;
for(int i=0;i<n-1;i++) {
way[A[i]].push_back(B[i]);
way[B[i]].push_back(A[i]);
}
cur = -1;
dfs(0,-1);
ll wow = (1<<18);
for(int i=0;i<n;i++) Code(i,st[i]*wow + ft[i]);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |