# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1058829 | jamjanek | City (JOI17_city) | C++14 | 188 ms | 53772 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;
vector<int>graf[250010];
int preorder[250010], post[250010], preit, postit;
void dfs(int x, int o){
preorder[x]=preit++;
for(auto j: graf[x])
if(j!=o)
dfs(j, x);
post[x]=postit++;
}
void Encode(int n, int A[], int B[])
{
int i;
for(i=0;i<n-1;i++){
graf[A[i]].push_back(B[i]);
graf[B[i]].push_back(A[i]);
}
dfs(0,-1);
for (int i = 0; i < n; ++i) {
Code(i, (long long)preorder[i]*250000+post[i]);
}
}
#include "Device.h"
#include<bits/stdc++.h>
using namespace std;
void InitDevice()
{
}
int Answer(long long S, long long T)
{
int X1=S/250000, X2=S%250000;
int Y1=T/250000, Y2=T%250000;
if(X1<=Y1 && X2>=Y2)return 1;
if(Y1<=X1 && Y2>=X2)return 0;
return 2;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |