Submission #617348

#TimeUsernameProblemLanguageResultExecution timeMemory
617348DanShadersStations (IOI20_stations)C++17
0 / 100
3025 ms2097152 KiB
//Fgrader.cpp
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;

#define x first
#define y second
using ll = long long;
using ld = long double;
#define all(x) begin(x), end(x)
#define sz(x) ((int) (x).size())

const int N = 1010;

vector<int> g[N];
vector<int> ans;
int timer = 0;

void dfs(int u = 0, int p = -1, int depth = 1) {
	if (depth) {
		ans[u] = timer++;
	}
	for (int v : g[u]) {
		if (v != p) {
			dfs(v, u, depth ^ 1);
		}
	}
	if (!depth) {
		ans[u] = timer++;
	}
}

vector<int> label(int n, int, vector<int> u, vector<int> v) {
	for (int i = 0; i < n - 1; ++i) {
		g[u[i]].push_back(v[i]);
		g[v[i]].push_back(u[i]);
	}
	ans.resize(n);
	dfs();
	return ans;
}

int find_next_station(int s, int t, vector<int> c) {
	// if (sz(c) == 1) {
	// 	return c[0];
	// }
	// if (!s) {
	// 	return *lower_bound(all(c), t);
	// }
	// if (s < c[0]) {
	// 	if (t < s || t > c[sz(c) - 2]) {
	// 		return c.back();
	// 	} else {
	// 		return *lower_bound(all(c), t);
	// 	}
	// } else {
	// 	if (t < c[1] || t > s) {
	// 		return c[0];
	// 	} else {
	// 		return *--upper_bound(all(c), t);
	// 	}
	// }
	return c[0];
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...