Submission #308577

# Submission time Handle Problem Language Result Execution time Memory
308577 2020-10-01T14:46:00 Z szekelymilan Stations (IOI20_stations) C++14
0 / 100
1251 ms 640 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 = 1) {
	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(1);

	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 3 ms 384 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=10008
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 504 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=2970
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 508 KB Invalid labels (values out of range). scenario=1, k=1000000, vertex=2, label=1361553
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1251 ms 640 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 -