Submission #417655

# Submission time Handle Problem Language Result Execution time Memory
417655 2021-06-04T06:02:06 Z lakshith_ Stations (IOI20_stations) C++14
0 / 100
3000 ms 2097156 KB
#include "stations.h"
#include <bits/stdc++.h>

using namespace std;

#define what_is(a) cout << #a << " is " << a << "\n"
#define checker(a) cout << "checker reached " << a << "\n"

vector<vector<int>> adj(1000,vector<int>());

vector<int> path;

void dfs(int u,int p){
	path.push_back(u);
	for(int v:adj[u])
		if(v!=p)dfs(v,u);
	//what_is(u);
}

std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
	vector<int> labels;
	int counts[n];
	memset(counts,0,sizeof(counts));
	for(int i=0;i<n-1;i++){
		adj[u[i]].push_back(v[i]);
		adj[v[i]].push_back(u[i]);
		counts[u[i]]++,counts[v[i]]++;
	}
	int start = 0;
	for(int i=0;i<n;i++){
		if(counts[i]==1){
			start = i;
			break;
		}
	}
	dfs(start,-1);
	labels.assign(n,0);
	for(int i=0;i<n;i++)
		labels[path[i]] = i;
	return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
	if(s<=t)
		return max(c[0],c[1]);
	else
		return min(c[0],c[1]);
}
# Verdict Execution time Memory Grader output
1 Runtime error 2250 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 967 ms 406488 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1804 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 901 ms 400 KB Output is correct
2 Runtime error 1482 ms 2097156 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3026 ms 2097156 KB Time limit exceeded
2 Halted 0 ms 0 KB -