Submission #1073532

# Submission time Handle Problem Language Result Execution time Memory
1073532 2024-08-24T15:46:14 Z allin27x Stations (IOI20_stations) C++17
0 / 100
2268 ms 2097152 KB
#include <bits/stdc++.h>
using namespace std;
#include "stations.h"
#include <vector>

const int N = 1001;
vector<int> adj[N];
vector<int> order;

void dfs(int i, int p) {
	order.push_back(i);
	for (int c: adj[i]) {
		if (c == p) continue;
		dfs(c,i);
	}
}

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

int find_next_station(int s, int t, std::vector<int> c) {
	if (s<t) return s+1;
	return s-1;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1262 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1484 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 604 ms 944 KB Output is correct
2 Incorrect 500 ms 684 KB Wrong query response.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2268 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -