# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
698436 | amunduzbaev | City (JOI17_city) | C++17 | 459 ms | 44768 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 MX = 25e4;
void Encode(int n, int a[], int b[]){
vector<vector<int>> edges(n);
for(int i=0;i+1<n;i++){
edges[a[i]].push_back(b[i]);
edges[b[i]].push_back(a[i]);
}
vector<int> tin(n), tout(n);
int t = 0;
function<void(int, int)> dfs = [&](int u, int p){
tin[u] = ++t;
for(auto x : edges[u]){
if(x == p) continue;
dfs(x, u);
}
tout[u] = t;
};
dfs(0, 0);
for(int i=0;i<n;i++){
tin[i]--, tout[i]--;
Code(i, tin[i] * 1ll * MX + tout[i]);
}
}
#include "Device.h"
#include "bits/stdc++.h"
using namespace std;
const int MX = 25e4;
void InitDevice(){
}
int Answer(long long a, long long b){
int l = a / MX, r = a % MX;
int L = b / MX, R = b % MX;
if(L <= l && r <= R){
return 0;
}
if(l <= L && R <= r){
return 1;
}
return 2;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |