# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
383175 | kshitij_sodani | City (JOI17_city) | C++14 | 528 ms | 57428 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.
//#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long llo;
#define mp make_pair
#define pb push_back
#define a first
#define b second
#define endl '\n'
#include "Encoder.h"
vector<llo> adj[250001];
llo co=0;
llo st[250001];
llo endd[250001];
void dfs(llo no,llo par2=-1){
st[no]=co;
for(auto j:adj[no]){
if(j!=par2){
dfs(j,no);
}
}
co++;
endd[no]=co-1;
}
void Encode(int n, int aa[], int bb[])
{
for(int i=0;i<n-1;i++){
adj[aa[i]].pb(bb[i]);
adj[bb[i]].pb(aa[i]);
}
dfs(0);
for (int i = 0; i < n; ++i) {
Code(i, st[i]*250000+endd[i]);
}
}
//#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long llo;
#define mp make_pair
#define pb push_back
#define a first
#define b second
#define endl '\n'
#include "Device.h"
void InitDevice()
{
}
int Answer(long long S, long long T)
{ llo xx2=250000;
pair<llo,llo> xx={S/xx2,S%xx2};
pair<llo,llo> yy={T/xx2,T%xx2};
//0 if T is parent of S
//1 if S is parent of T
if(yy.a>=xx.a and yy.b<=xx.b){
return 1;
}
if(yy.a<=xx.a and yy.b>=xx.b){
return 0;
}
return 2;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |