Submission #430188

# Submission time Handle Problem Language Result Execution time Memory
430188 2021-06-16T11:58:45 Z APROHACK Stations (IOI20_stations) C++14
0 / 100
3000 ms 2097156 KB
#include "stations.h"
#include <bits/stdc++.h>
#include <vector>
#define PB push_back
using namespace std;
vector<int>ady[1001];
int lab[1001];
int cur = 0;
int dfs(int node, int parent){
	for(auto i:ady[node]){
		if(i==parent)continue;
		dfs(i, node);
	}
	lab[node]=cur++;
	return 1;
}
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++){
		ady[u[i]].PB(v[i]);
		ady[v[i]].PB(u[i]);
	}
	dfs(0, -1);
	for(int i = 0 ; i < n-1 ; i++){
		labels[i]=lab[i];
		//cout<<lab[i]<<" ";
	}
	return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
	vector<int>::iterator ll = lower_bound(c.begin(), c.end(), t);

	if(ll!=c.end())return c[(ll-c.begin())];
	else return c[c.size()-1];
}
# Verdict Execution time Memory Grader output
1 Runtime error 2093 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3049 ms 416 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1915 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1057 ms 528 KB Output is correct
2 Runtime error 1377 ms 2097156 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3192 ms 1613648 KB Time limit exceeded
2 Halted 0 ms 0 KB -