Submission #354620

# Submission time Handle Problem Language Result Execution time Memory
354620 2021-01-22T04:30:53 Z Dilshod_Imomov Stations (IOI20_stations) C++17
0 / 100
947 ms 776 KB
#include "stations.h"
#include <bits/stdc++.h>

using namespace std;

const int N = 1e3 + 7;

vector < int > lb, adj[N], used(N);
int num;

void dfs( int v ) {
	used[v] = 1;
	lb[v] = num++;
	for ( auto u: adj[v] ) {
		if ( !used[u] ) {
			dfs(u);
		}
	}
}

std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
	for ( int i = 0; i < n - 1; i++ ) {
		int x = u[i], y = v[i];
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	lb.assign(n, 0);
	dfs(1);
	return lb;
}

int find_next_station(int s, int t, std::vector<int> c) {
	int pr = c[0];
	for ( auto x: c ) {
		if ( x == pr ) {
			continue;
		}
		if ( x > t ) {
			break;
		}
		pr = x;
	}
	return pr;
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 492 KB Invalid labels (duplicates values). scenario=1, label=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 492 KB Invalid labels (duplicates values). scenario=1, label=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 492 KB Invalid labels (duplicates values). scenario=1, label=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 947 ms 776 KB Output is correct
2 Incorrect 1 ms 364 KB Invalid labels (duplicates values). scenario=1, label=0
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 492 KB Invalid labels (duplicates values). scenario=1, label=0
2 Halted 0 ms 0 KB -