Submission #423975

# Submission time Handle Problem Language Result Execution time Memory
423975 2021-06-11T14:54:50 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);
}

std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
	for(int i=0;i<n;i++){
		adj[u[i]].push_back(v[i]);
		adj[v[i]].push_back(u[i]);
	}
	int start = 0;
	for(int i=0;i<n;i++)
		if(adj[i].size()==0){
			start = i;
			break;
		}
	dfs(start,start);
	vector<int> lbl(n);
	for(int i=0;i<n;i++)
		lbl[path[i]] = i;
	return lbl;
}

int find_next_station(int s, int t, std::vector<int> c) {
	if(c.size()==1)return c[0];
	if(s<t)
		return c[1];
	else 
		return c[0];
}
# Verdict Execution time Memory Grader output
1 Runtime error 2256 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3109 ms 1051656 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1797 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1061 ms 400 KB Output is correct
2 Runtime error 1460 ms 2097156 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1520 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -