Submission #430762

# Submission time Handle Problem Language Result Execution time Memory
430762 2021-06-17T03:44:51 Z JUANDI321 Stations (IOI20_stations) C++17
5 / 100
872 ms 908 KB
#include "stations.h"
#include <vector>
#include <iostream>
#include <cstring>
 
using namespace std;
vector<vector<int>> g(1000+10);
vector<int> l(10000 +10);
bool ch[1010];

void dfs(int node, int i, int p)
{
	//if(ch[node])return;
	//ch[node]=true;
	l[node] = i;
	//cout<<node<<endl;
	for(int y : g[node])
	{
		if(y != p)
		{
			dfs(y, i+1, node);
		}
	}
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) 
{
	vector<int> labels(n);
	l.resize(n);
	for(int i = 0; i < n-1; i++)
	{
		g[u[i]].push_back(v[i]);
    	g[v[i]].push_back(u[i]);
	}
	int spn = 0;
	for(int i = 0; i < n; i++)
	{
		if(g[i].size() == 1)
		{
			spn = i;
			break;
		}
	}
	dfs(spn, 0, -1);
	//cout<<"hola"<<endl;
	for (int i = 0; i < n; i++) 
	{
		labels[i] = l[i];
		//cout<<"l[i] "<<l[i]<<" lb i "<<labels[l[i]]<<endl;
	}
	//cout<<"---------"<<endl;
	for(int i = 0; i<n+2; i++)ch[i]=false;
	for(int i=0; i<n; i++) g[i].clear(); 
	l.clear();
	return labels;
}
 
int find_next_station(int s, int t, vector<int> c) 
{
	if(t>s)return s+1;
	return s-1;
}
# Verdict Execution time Memory Grader output
1 Correct 543 ms 908 KB Output is correct
2 Correct 466 ms 764 KB Output is correct
3 Correct 867 ms 656 KB Output is correct
4 Correct 683 ms 680 KB Output is correct
5 Correct 550 ms 676 KB Output is correct
6 Correct 424 ms 672 KB Output is correct
7 Correct 472 ms 688 KB Output is correct
8 Correct 1 ms 728 KB Output is correct
9 Correct 4 ms 724 KB Output is correct
10 Correct 2 ms 728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 408 KB Invalid labels (duplicates values). scenario=0, label=10
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 587 ms 688 KB Output is correct
2 Correct 449 ms 732 KB Output is correct
3 Correct 829 ms 656 KB Output is correct
4 Correct 597 ms 732 KB Output is correct
5 Correct 583 ms 680 KB Output is correct
6 Correct 473 ms 680 KB Output is correct
7 Correct 466 ms 656 KB Output is correct
8 Correct 3 ms 724 KB Output is correct
9 Correct 5 ms 732 KB Output is correct
10 Correct 1 ms 720 KB Output is correct
11 Incorrect 1 ms 352 KB Invalid labels (duplicates values). scenario=1, label=2
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 853 ms 656 KB Output is correct
2 Correct 646 ms 684 KB Output is correct
3 Correct 553 ms 732 KB Output is correct
4 Correct 1 ms 724 KB Output is correct
5 Correct 4 ms 724 KB Output is correct
6 Correct 0 ms 724 KB Output is correct
7 Incorrect 1 ms 352 KB Invalid labels (duplicates values). scenario=0, label=2
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 515 ms 768 KB Output is correct
2 Correct 451 ms 656 KB Output is correct
3 Correct 872 ms 656 KB Output is correct
4 Correct 625 ms 676 KB Output is correct
5 Correct 610 ms 656 KB Output is correct
6 Correct 462 ms 660 KB Output is correct
7 Correct 458 ms 680 KB Output is correct
8 Correct 3 ms 732 KB Output is correct
9 Correct 5 ms 724 KB Output is correct
10 Correct 2 ms 724 KB Output is correct
11 Incorrect 4 ms 388 KB Invalid labels (duplicates values). scenario=0, label=10
12 Halted 0 ms 0 KB -