# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
72715 | Mamnoon_Siam | City (JOI17_city) | C++17 | 542 ms | 53368 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;
const int maxn = 1 << 18;
vector<int> g[maxn];
int tym = 0;
void dfs(int u, int p) {
int L = tym++, R;
for(int v : g[u]) if(v - p) {
dfs(v, u);
} R = tym - 1;
Code(u, 1LL * L * 250000 + R);
}
void Encode(int N, int A[], int B[]) {
for(int i = 0; i < N - 1; i++) {
int u = A[i], v = B[i];
g[u].emplace_back(v);
g[v].emplace_back(u);
} dfs(0, -1);
}
#include "Device.h"
#include <bits/stdc++.h>
using namespace std;
void InitDevice() {}
int Answer(long long S, long long T) {
int L_X = S / 250000, R_X = S % 250000;
int L_Y = T / 250000, R_Y = T % 250000;
if(L_Y <= L_X and R_X <= R_Y) return 0;
if(L_X <= L_Y and R_Y <= R_X) return 1;
return 2;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |