Submission #424125

# Submission time Handle Problem Language Result Execution time Memory
424125 2021-06-11T17:03:44 Z lakshith_ Stations (IOI20_stations) C++14
0 / 100
5 ms 756 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;
 
int m;
 
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*m+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;i++)
		adj[i] = vector<int>();
	for(int i=0;i<n-1;i++){
		adj[u[i]].push_back(v[i]);
		adj[v[i]].push_back(u[i]);
	}
	m=1000;
	//for(int i=0;i<n;i++)
		//m = max(m,(int)adj[i].size());
	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)/m;
		if(a==b)break;
	}
	if(a==b)return (s-1)/m;
	a=s,b=t;
	int p=b;
	while(b>0){
		p=b;
		b = (b-1)/m;
		if(a==b)break;
	}
	if(a==b)return p;
	return (s-1)/m;
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 440 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=-452758934
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 328 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=3, label=1002
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 436 KB Invalid labels (values out of range). scenario=1, k=1000000, vertex=1, label=-1486640022
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 756 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 448 KB Invalid labels (values out of range). scenario=1, k=1000000000, vertex=2, label=-1496863639
2 Halted 0 ms 0 KB -