Submission #432640

# Submission time Handle Problem Language Result Execution time Memory
432640 2021-06-18T11:54:59 Z saleh Stations (IOI20_stations) C++17
0 / 100
3000 ms 704 KB
#include "stations.h"
#include <bits/stdc++.h>


using namespace std;

const int MAXN = 1000 + 23;

vector<int> g[MAXN];
int such;
vector<int> labels;

int dfs(int v, int p = -1, int nat = -1) {
	if (v == such) return nat;
	for (auto i : g[v]) if (i != p) {
		if (p == -1) {
			int tmp = dfs(i, v, i);
			if (tmp != -1) return tmp;
		}
		else {
			int tmp = dfs(i, v, nat);
			if (tmp != -1) return tmp;
		}
	}
	return -1;
}

vector<int> label(int n, int k, vector<int> u, vector<int> v) {
	labels.clear();
	for (int i = 0; i < n; i++) labels.push_back(i);
	return labels;
}

int find_next_station(int s, int t, vector<int> c) {
	such = t;
	for (int i = 0; i < MAXN - 1; i++) g[i / 2].push_back(i + 1), g[i + 1].push_back(i / 2);
	return dfs(s, t);
}
/*
int main() {
	for (auto i : label(3, 8, {0, 1}, {1, 2})) cout << i << endl;
	return 0;
}*/
# Verdict Execution time Memory Grader output
1 Execution timed out 3051 ms 700 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3046 ms 696 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3032 ms 636 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3049 ms 528 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3030 ms 704 KB Time limit exceeded
2 Halted 0 ms 0 KB -