# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
67269 | ikura355 | City (JOI17_city) | C++14 | 562 ms | 56656 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];
int 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);
for(int i=0;i<n;i++) Code(i,(ll)st[i]*(1<<18) + ft[i]);
}
#include "Device.h"
#include<bits/stdc++.h>
using namespace std;
void InitDevice() {
}
int Answer(long long S, long long T) {
int lu = S/(1<<18), ru = S%(1<<18);
int lv = T/(1<<18), rv = T%(1<<18);
if(lv<=lu && lu<=rv) return 0;
if(lu<=lv && lv<=ru) return 1;
return 2;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |