Submission #434304

# Submission time Handle Problem Language Result Execution time Memory
434304 2021-06-20T22:03:44 Z Play_Erwan Stations (IOI20_stations) C++14
0 / 100
1 ms 356 KB
#include "stations.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define F first
#define S second

int aqui,cont;
vector<int> adj[1000],l;
bool mk[1000];

void dfs(int x){
    mk[x]=1;
    l[x]=cont;
    cont++;
    for(auto y:adj[x])if(!mk[y])dfs(y);
}

std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
	for (int i = 0; i < n-1; i++) {
		adj[u[i]].pb(v[i]);
		adj[v[i]].pb(u[i]);
	}
    for(int i=0;i<n;i++)l.pb(0);
	for(int i=0;i<n;i++)if(adj[i].size()==1){aqui=i; break;}

	dfs(aqui);
//    for(auto x:l)cout<<x<<" ";
//    cout<<"\n";
	return l;
}

int find_next_station(int s, int t, std::vector<int> c) {
	if(t>s)return c[c.size()-1];
	else return c[0];
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Invalid length of array as the response of 'label'. scenario=1, n=3, len=13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 356 KB Invalid length of array as the response of 'label'. scenario=1, n=994, len=1990
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 320 KB Invalid length of array as the response of 'label'. scenario=1, n=997, len=999
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=1, n=2, len=4
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 296 KB Invalid length of array as the response of 'label'. scenario=1, n=998, len=1001
2 Halted 0 ms 0 KB -