Submission #434292

# Submission time Handle Problem Language Result Execution time Memory
434292 2021-06-20T21:35:56 Z Play_Erwan Stations (IOI20_stations) C++14
0 / 100
1 ms 296 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,m=1e9,M=-1,cont;
vector<int> adj[1000],l(1000);
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]);
	}
    l.resize(n);
	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){for(auto x:c)M=max(M,x); return M;}
	else {for(auto x:c)m=min(m,x); return m;}
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 200 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 296 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 200 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 200 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 200 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -