Submission #424101

# Submission time Handle Problem Language Result Execution time Memory
424101 2021-06-11T16:40:42 Z lakshith_ Stations (IOI20_stations) C++14
0 / 100
2654 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> lbl;
 
void dfs(int u,int p,int d){
	lbl[u] = d;
	for(int i=0;i<(int)adj[u].size();i++)
		if(adj[u][i]!=p)
			dfs(adj[u][i],u,d*8+i+1);
}
 
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
	lbl =  vector<int>(n);
	for(int i=0;i<n-1;i++){
		adj[u[i]].push_back(v[i]);
		adj[v[i]].push_back(u[i]);
	}
	dfs(0,0,0);
	return lbl;
}
 
int find_next_station(int s, int t, std::vector<int> c) {
	int a =s,b=t;
	while(a>0){
		a= (a-1)/8;
		if(a==b)break;
	}
	if(a==b)return (s-1)/8;
	a=s,b=t;
	int p=b;
	while(b>0){
		p=b;
		b = (b-1)/8;
		if(a==b)break;
	}
	if(a==b)return p;
	return (s-1)/8;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 440 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 552 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1711 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1107 ms 548 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2654 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -