Submission #815843

# Submission time Handle Problem Language Result Execution time Memory
815843 2023-08-09T00:59:23 Z eltu0815 Stations (IOI20_stations) C++14
0 / 100
706 ms 596 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> graph[1005];
void dfs(int node, int par, int val, vector<int>& label) {
    label[node] = val;
    for(auto v : graph[node]) if(v != par) dfs(v, node, val + 1, label);
}

std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
	std::vector<int> labels(n, k + 1);
	for(int i = 0; i < n; ++i) graph[i].clear();
	for(int i = 0; i < n - 1; ++i) {
        graph[u[i]].push_back(v[i]);
        graph[v[i]].push_back(u[i]);
	}
	for(int i = 0; i < n; ++i) {
        if(graph[i].size() == 1) {
            dfs(0, -1, 0, labels);
            break;
        }
	}
	return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
    if(c.size() == 1) return c[0];
    if(s < t) return c[1];
	return c[0];
}

/*
2

2 1
0 1
2
0 1 1
1 0 0

3 3
0 1
1 2
3
1 0 0
0 1 1
2 0 1
*/
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 320 KB Invalid labels (duplicates values). scenario=0, label=1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 336 KB Invalid labels (duplicates values). scenario=0, label=1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 320 KB Invalid labels (duplicates values). scenario=1, label=22
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 706 ms 596 KB Output is correct
2 Incorrect 0 ms 256 KB Invalid labels (duplicates values). scenario=1, label=1
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 316 KB Invalid labels (duplicates values). scenario=1, label=182
2 Halted 0 ms 0 KB -