# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
315321 | NintsiChkhaidze | City (JOI17_city) | C++14 | 230 ms | 43248 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>
#define n 250000
#define pb push_back
using namespace std;
int ind,in[n+5],out[n+5];
vector <int> v[n+5];
void dfs(int x,int pr){
in[x] = ++ind;
for (int j = 0; j < v[x].size(); j++){
int to = v[x][j];
if (to == pr) continue;
dfs(to,x);
}
out[x] = ind;
}
void Encode(int N, int A[], int B[])
{
for (int i=0;i<N;i++)
v[A[i]].pb(B[i]),v[B[i]].pb(A[i]);
ind=-1;
dfs(0,0);
for (int i = 0; i < N; ++i)
Code(i, in[i]*n + out[i]);
}
#include "Device.h"
#include <bits/stdc++.h>
#define n 250000
using namespace std;
void InitDevice(){
}
int Answer(long long S, long long T){
int Sout = S%n,Tout = T%n,Sin = (S - Sout)/n,Tin = (T - Tout)/n;
if (Sin < Tin && Sout >= Tout) return 1;
else
if (Tin < Sin && Tout >= Sout) return 0;
else return 2;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |