# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1008911 | emptypringlescan | City (JOI17_city) | C++17 | 216 ms | 55472 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>
using namespace std;
#include "Encoder.h"
vector<int> adj[250005];
long long pre[250005],pos[250005];
int cur=0;
void dfs(int x, int p){
cur++;
pre[x]=cur;
for(int i:adj[x]){
if(i!=p) dfs(i,x);
}
pos[x]=cur;
}
void Encode(int n, int u[], int v[]){
for(int i=0; i<n-1; i++){
adj[u[i]].push_back(v[i]);
adj[v[i]].push_back(u[i]);
}
dfs(0,-1);
for(int i=0; i<n; i++){
Code(i,pre[i]<<18ll|pos[i]);
}
}
#include <bits/stdc++.h>
using namespace std;
#include "Device.h"
void InitDevice(){
}
int Answer(long long a, long long b){
long long prea=a>>18ll,posa=a^(prea<<18ll);
long long preb=b>>18ll,posb=b^(preb<<18ll);
if(preb<=prea&&posa<=posb) return 0;
else if(prea<=preb&&posb<=posa) return 1;
return 2;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |