답안 #434828

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
434828 2021-06-21T22:08:02 Z jairRS 기지국 (IOI20_stations) C++17
0 / 100
4 ms 544 KB
#include "stations.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;

int curLabel = 0;

void dfs(int src, int p, vector<int> & labels, vector<vector<int>> & adj){
	labels[src] = curLabel;
	curLabel++;

	for(int a : adj[src]){
		if(a == p) continue;
		dfs(a, src, labels, adj);
	}
}

std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
	std::vector<int> labels(n);
	vector<vector<int>> adj(n);
	for (int i = 0; i < u.size(); i++)
	{
		adj[u[i]].push_back(v[i]);
		adj[v[i]].push_back(u[i]);
	}

	curLabel = 0;
	dfs(0, -1, labels, adj);
}

int find_next_station(int s, int t, std::vector<int> c) {
	auto p = upper_bound(c.begin(), c.end(), t) - 1;
	return *p;
}

Compilation message

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:21:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |  for (int i = 0; i < u.size(); i++)
      |                  ~~^~~~~~~~~~
stations.cpp:29:1: warning: no return statement in function returning non-void [-Wreturn-type]
   29 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 540 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 536 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 544 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 520 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -