Submission #462521

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

using namespace std;

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

void dfs(vector<int>& tin, int u, int p, int d){
	if(!d) tin[u] = timer++;
	for(int v : g[u]) if(v != p){
		dfs(tin, v, u, 1 - d);
	}
	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]);
	}
	vector<int> tin(n);

	dfs(tin, 0, -1, 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 1 ms 632 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 556 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1458 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 959 ms 400 KB Output is correct
2 Runtime error 1038 ms 2097156 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2095 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -