Submission #462525

# Submission time Handle Problem Language Result Execution time Memory
462525 2021-08-10T17:09:15 Z wind_reaper Stations (IOI20_stations) C++17
0 / 100
3000 ms 2097156 KB
#include "stations.h"
#include <bits/stdc++.h>

using namespace std;

vector<int> g[1000], tin;
int timer;

void dfs(int u, int p, int d){
	if(!d) tin[u] = timer++;
	for(int v : g[u]) if(v != p){
		dfs(v, u, d ^ 1);
	}
	if(d) tin[u] = timer++;
}

vector<int> label(int n, int k, vector<int> u, vector<int> v){
	for(int i = 0; i < n - 1; i++){
		g[u[i]].push_back(v[i]);
		g[v[i]].push_back(u[i]);
	}
	tin.resize(n);

	dfs(0, 0, 0);

	return tin;
}

int find_next_station(int s, int t, vector<int> c){
	int m = c.size(), i;
	if(s < c[0]){
		for(i = 0; i < m - 1; i++)
			if(i == 0 ? s : c[i-1] < t && c[i] >= t)
				break;
	}
	else{
		for(i = m - 1; i > 0; --i)
			if(i + 1 == m ? s : c[i+1] > t && c[i] <= t)
				break;
	}

	return c[i];
}
# Verdict Execution time Memory Grader output
1 Runtime error 1237 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3048 ms 428 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1212 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 996 ms 520 KB Output is correct
2 Runtime error 1029 ms 2097156 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2066 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -