Submission #402643

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

vector<int> label(int n, int k, vector<int> a, vector<int> b)
{
    vector<int> col(n); lab = 0; col.clear();
    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, col, -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 1 ms 200 KB Invalid length of array as the response of 'label'. scenario=0, n=10, len=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 300 KB Invalid length of array as the response of 'label'. scenario=0, n=996, len=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Invalid length of array as the response of 'label'. scenario=0, n=2, len=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Invalid length of array as the response of 'label'. scenario=0, n=2, len=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 300 KB Invalid length of array as the response of 'label'. scenario=0, n=3, len=0
2 Halted 0 ms 0 KB -