Submission #354659

# Submission time Handle Problem Language Result Execution time Memory
354659 2021-01-22T04:47:38 Z Dilshod_Imomov Stations (IOI20_stations) C++17
0 / 100
974 ms 864 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++;
	// cout << "v -> " << v << ' ' << num - 1 << endl;
	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.clear();
	lb.resize(n);
	dfs(0);
	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 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 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 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 974 ms 864 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 -