답안 #305691

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
305691 2020-09-23T19:44:07 Z arthurconmy 기지국 (IOI20_stations) C++14
0 / 100
2 ms 768 KB
#ifndef ARTHUR_LOCAL
	#include "stations.h"
#endif

#ifdef ARTHUR_LOCAL
	#include <bits/stdc++.h>
#endif

using namespace std;
using ll = long long;

vector<int> adj[1001];
bool vis[1001];
int curv;
int labellist[1001];

void dfs(int v)
{
	vis[v]=1;
	labellist[v]=curv++;

	for(auto u:adj[v])
	{
		if(!vis[u]) dfs(u);
	}
}

vector<int> label(int n, int k, vector<int> U, vector<int> V) 
{
	for(int i=0; i<n; i++)
	{
		adj[i].clear();
		vis[i]=0;
	}

	for(int i=0; i<n-1; i++)
	{
		adj[U[i]].push_back(V[i]);
		adj[V[i]].push_back(U[i]);
	}

	for(int i=0; i<n-1; i++)
	{
		if(adj[i].size() == 1)
		{
			curv=0;
			dfs(i);
			break;
		}
	}
}

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

	if(s < t)
	{
		return C[1];
	}

	else
	{
		return C[0];
	}
}

Compilation message

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:51:1: warning: no return statement in function returning non-void [-Wreturn-type]
   51 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -