Submission #308580

# Submission time Handle Problem Language Result Execution time Memory
308580 2020-10-01T14:48:13 Z szekelymilan Stations (IOI20_stations) C++14
0 / 100
1115 ms 916 KB
#include "stations.h"
#include <vector>

std::vector<std::vector<int>> G;
std::vector<bool> visited;
std::vector<int> labels;
int time = 0;

void DFS(int node = 0) {
	visited[node] = true;
	labels[node] += (time++) * 2000;

	for (int v : G[node])
		if (!visited[v])
			DFS(v);
	
	labels[node] += time++;
}

std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
	G.resize(n);
	visited.resize(n);
	labels.resize(n);

	for (int i = 0; i < n - 1; i++) {
		G[u[i]].push_back(v[i]);
		G[v[i]].push_back(u[i]);
	}

	DFS();

	return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
	for (int node : c)
		if (node / 2000 < t / 2000 && t / 2000 < node % 2000 && node / 2000 > s / 2000 && node % 2000 < s % 2000)
			return node;
	
	for (int node : c)
		if (node / 2000 < s / 2000 && node % 2000 > s % 2000)
			return node;
	
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 504 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=14014
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 512 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=1991
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1115 ms 916 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 512 KB Invalid labels (duplicates values). scenario=1, label=0
2 Halted 0 ms 0 KB -