Submission #72715

#TimeUsernameProblemLanguageResultExecution timeMemory
72715Mamnoon_SiamCity (JOI17_city)C++17
22 / 100
542 ms53368 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...