Submission #1073732

# Submission time Handle Problem Language Result Execution time Memory
1073732 2024-08-24T19:31:04 Z allin27x Stations (IOI20_stations) C++17
0 / 100
3 ms 940 KB
#include <bits/stdc++.h>
using namespace std;
#include "stations.h"

const int N = 1001;
vector<int> adj[N];
int tin[N];
int tout[N];
int tp = 0;

void dfs(int i, int p) {
	tin[i] = tp++;
	for (int c: adj[i]) {
		if (c == p) continue;
		dfs(c,i);
	}
	tout[i] = tp;
}

std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
	for (int i=0; i<n; i++) adj[i].clear();
	std::vector<int> labels(n);
	for (int i=0; i<n-1; i++) {
		adj[u[i]].push_back(v[i]);
		adj[v[i]].push_back(u[i]);
	}
	tp = 0;
	dfs(0,0);
	for (int i=0; i<n; i++) labels[i] = 1000*tin[i] + tout[i];
	return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
	int s_in = s/1000; int s_out = s%1000;
	int t_in = t/1000; int t_out = t%1000;
	if (s_in <= t_in && t_out <= s_out) {
		// t is below s
		assert(0);
	} else {
		for (int x: c) {
			if (x/1000 < s_in) return x;
		}
	}
	return -1;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=6010
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 344 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1512
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 940 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 940 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 940 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -