Submission #1080013

# Submission time Handle Problem Language Result Execution time Memory
1080013 2024-08-29T06:09:43 Z Faisal_Saqib Stations (IOI20_stations) C++17
0 / 100
3000 ms 2097152 KB
#include "stations.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
const int N=1e3+100;
vector<int> ma[N];
vector<int> labels;
void dfs(int x,int v,int p)
{
	labels[x]=v;
	for(auto y:ma[x])
	{
		if(y==p)continue;
		dfs(y,v+1,x);
	}
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
	labels.resize(n,0);
	for(int i=0;i<(n-1);i++)
	{
		ma[u[i]].push_back(v[i]);
		ma[v[i]].push_back(u[i]);
	}
	for(int i=0;i<n;i++)
	{
		if(ma[i].size()==1)
		{
			dfs(i,0,-1);
		}
	}
	return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
	if(t>s)
		return *max_element(begin(c),end(c));
	return *min_element(begin(c),end(c));
}
# Verdict Execution time Memory Grader output
1 Runtime error 1827 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3005 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1839 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 633 ms 684 KB Output is correct
2 Incorrect 467 ms 684 KB Wrong query response.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3106 ms 2023608 KB Time limit exceeded
2 Halted 0 ms 0 KB -