# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
53819 | grumpy_gordon | City (JOI17_city) | C++17 | 0 ms | 0 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;
typedef long long ll;
const int maxn = 2e5 + 10;
const double w = 1.05;
vector<int> e[maxn];
const double w = 1.05;
int t;
void dfs(int v, int par){
int tin = t++;
for (int i : e[v])
if (i != par)
dfs(i, v);
int val = 0;
double kek = 1;
while ((int)pow(w, val) < t - tin)
val++;
t = tin + (int)pow(w, val);
Code(v, val * (ll)maxn + tin);
}
void Encode(int N, int A[], int B[])
{
int n = N;
for (int i = 0; i < n - 1; i++){
int v = A[i], u = B[i];
e[v].push_back(u);
e[u].push_back(v);
}
dfs(0, -1);
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 10;
const double w = 1.05;
void InitDevice(){
}
int Answer(long long S, long long T)
{
int a = S / maxn, b = S % maxn, c = T / maxn, d = T % maxn;
a = b + (int)pow(w, a) - 1;
c = d + (int)pow(w, c) - 1;
if (a >= c && b <= d)
return 1;
if (a <= c && b >= d)
return 0;
return 2;
}