Submission #430718

# Submission time Handle Problem Language Result Execution time Memory
430718 2021-06-17T02:44:47 Z JUANDI321 Stations (IOI20_stations) C++17
0 / 100
865 ms 696 KB
#include "stations.h"
#include <vector>
#include <iostream>

using namespace std;
vector<vector<int>> g(1010);
vector<int> l(1010);
bool ch[1010];

/*void dfs(int node, int i)
{
	if(ch[node])return;
	ch[node]=true;
	l[i] = node;
	//cout<<node<<endl;
	for(int y : g[node])
	{
		if(!ch[y])
		{
			dfs(y, i+1);
		}
	}
}*/
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
	vector<int> labels(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);//cout<<"hola"<<endl;
	for (int i = 0; i < n; i++) {
		labels[/*l[*/i/*]*/] = i;
		//cout<<"l[i] "<<l[i]<<" i "<<i<<endl;
	}
	return labels;
}

int find_next_station(int s, int t, vector<int> c) 
{
	if(t>s)return s+1;
	return s-1;
}

Compilation message

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:32:6: warning: variable 'spn' set but not used [-Wunused-but-set-variable]
   32 |  int spn = 0;
      |      ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 531 ms 520 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 441 ms 636 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 550 ms 696 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 865 ms 400 KB Output is correct
2 Incorrect 712 ms 552 KB Wrong query response.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 552 ms 684 KB Wrong query response.
2 Halted 0 ms 0 KB -