Submission #432613

# Submission time Handle Problem Language Result Execution time Memory
432613 2021-06-18T11:37:44 Z saleh Stations (IOI20_stations) C++17
0 / 100
2713 ms 2097156 KB
#include "stations.h"
#include <bits/stdc++.h>


using namespace std;

const int MAXN = 1000 + 23;

vector<int> g[MAXN];
vector<int> labels;
int cnt = 0;

void dfs(int v, int p = -1) {
	labels[v] = cnt++;
	for (auto i : g[v]) if (i != p) dfs(i, v);
}

vector<int> label(int n, int k, vector<int> u, vector<int> v) {
	for (int i = 0; i < n; i++) labels.push_back(0);
	for (int i = 0; i < n - 1; i++) {
		g[u[i]].push_back(v[i]), g[v[i]].push_back(u[i]);
	}
	for (int i = 0; i < n; i++) if (g[i].size() == 1) {
		dfs(i);
		break;
	}
//	assert(labels.size() == n);
	return labels;
}

int find_next_station(int s, int t, vector<int> c) {
	if (s < t) return s + 1;
	return s - 1;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 328 KB Invalid length of array as the response of 'label'. scenario=1, n=3, len=13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 300 KB Invalid length of array as the response of 'label'. scenario=1, n=994, len=1990
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1608 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Invalid length of array as the response of 'label'. scenario=1, n=2, len=4
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2713 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -