Submission #402526

# Submission time Handle Problem Language Result Execution time Memory
402526 2021-05-11T22:13:56 Z Dan4Life Stations (IOI20_stations) C++17
0 / 100
5 ms 416 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
vector<int> adj[1001], col(1001, -1);
int lab = 0;
void dfs(int s, int p)
{
    if(col[s]!=-1) col[s]=lab, lab++;
    for(auto u : adj[s])
        if(u!=p) dfs(u, s);
}

vector<int> label(int n, int k, vector<int> a, vector<int> b)
{
    col.resize(n); lab=0;
    for(int i = 0; i < n; i++) adj[i].clear();
	for (int i = 0; i < n-1; i++) {
		adj[a[i]].pb(b[i]);
		adj[b[i]].pb(a[i]);
	}
	for(int i = 0; i < n; i++){
        if(adj[i].size()==1){
            dfs(i, -1); break;
        }
	}
	return col;
}

int find_next_station(int s, int t, vector<int> c)
{
	if(c.size()==1)return c[0];
	for(int i = 0; i < (int)c.size(); i++)
        if(c[i]==t)return c[i];
	if(t<s)return c[0];
	return c[1];
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 416 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=-1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 320 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=-1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 312 KB Invalid labels (values out of range). scenario=0, k=1000000, vertex=0, label=-1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Invalid labels (values out of range). scenario=0, k=1000000000, vertex=0, label=-1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 328 KB Invalid labels (values out of range). scenario=0, k=1000000000, vertex=0, label=-1
2 Halted 0 ms 0 KB -