Submission #475201

# Submission time Handle Problem Language Result Execution time Memory
475201 2021-09-21T12:27:51 Z AdamGS Stations (IOI20_stations) C++14
0 / 100
3000 ms 2097156 KB
#include "stations.h"
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=1e3+7;
int pre[LIM], post[LIM], lpre, lpost;
vector<int>V[LIM];
void DFS(int x, int o) {
	++lpre;
	pre[x]=lpre;
	for(auto i : V[x]) if(i!=o) DFS(i, x);
	++lpost;
	post[x]=lpost;
}
vector<int>label(int n, int k, vector<int>u, vector<int>v) {
	vector<int>ans(n);
	rep(i, n-1) {
		V[u[i]].pb(v[i]);
		V[v[i]].pb(u[i]);
	}
	DFS(0, 0);
	rep(i, n) ans[i]=i;
	return ans;
}
int find_next_station(int s, int t, vector<int>c) {
	int ojciec=-1;
	for(auto i : c) if(pre[i]<pre[s]) ojciec=i;
	for(auto i : c) if(i!=ojciec && pre[i]<=pre[t] && post[i]>=post[t]) return i;
	return ojciec;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1491 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3037 ms 308 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1547 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1001 ms 508 KB Output is correct
2 Runtime error 1153 ms 2097156 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2796 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -