Submission #1055153

# Submission time Handle Problem Language Result Execution time Memory
1055153 2024-08-12T14:59:51 Z Gromp15 Stations (IOI20_stations) C++17
0 / 100
1 ms 344 KB
#include <bits/stdc++.h>
#define sz(x) (int)x.size()
#include "stations.h"
using namespace std;

std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
	vector<vector<int>> adj(n);
	for (int i = 0; i < n-1; i++) {
		adj[u[i]].emplace_back(v[i]);
		adj[v[i]].emplace_back(u[i]);
	}
	vector<int> tin(n);
	int timer = 0;
	auto dfs = [&](auto&& s, int v, int p) -> void {
		tin[v] = timer++;
		cout << "V: " << v << " " << tin[v] << '\n';
		for (int u : adj[v]) if (u != p) {
			s(s, u, v);
		}
	};
	dfs(dfs, 0, -1);
	return tin;
}

int find_next_station(int s, int t, std::vector<int> c) {
	if (s > t) {
		for (int x : c) if (x < s) return x;
	}
	else {
		for (int i = sz(c) - 1; i >= 0; i--) if (c[i] <= t) return c[i];
	}
	assert(0);
}
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -