Submission #432604

# Submission time Handle Problem Language Result Execution time Memory
432604 2021-06-18T11:33:14 Z saleh Stations (IOI20_stations) C++17
0 / 100
3000 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) {
	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]);
	}
	for (int i = 0; i < n; i++) if (g[i].size() == 1) {
		dfs(i);
		break;
	}
	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 Runtime error 1580 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3045 ms 332 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1598 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 791 ms 508 KB Output is correct
2 Incorrect 643 ms 400 KB Wrong query response.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2767 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -