Submission #432599

# Submission time Handle Problem Language Result Execution time Memory
432599 2021-06-18T11:31:38 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);
	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 2114 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3053 ms 308 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1569 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 888 ms 520 KB Output is correct
2 Incorrect 652 ms 508 KB Wrong query response.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2872 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -