# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1118016 | BlancaHM | Saveit (IOI10_saveit) | C++14 | 170 ms | 6040 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "grader.h"
#include "encoder.h"
#include <queue>
#include <vector>
using namespace std;
vector<int> shortest_path_to_all_cities(int source, vector<vector<int>> & adjacency) {
// Calculate length of shortest path from source to all cities in graph.
int num_cities = (int) adjacency.size();
vector<int> distances(num_cities, num_cities + 1);
distances[source] = 0;
queue<int> bfs_queue;
bfs_queue.push(source);
while (!bfs_queue.empty()) {
int city = bfs_queue.front();
bfs_queue.pop();
for (int & neighbour: adjacency[city]) {
if (distances[neighbour] > distances[city] + 1) {
distances[neighbour] = distances[city] + 1;
bfs_queue.push(neighbour);
}
}
}
return distances;
}
vector<vector<int>> calculate_distances_to_hubs(vector<vector<int>> & adjacency, int num_hubs) {
// Calculate length of shortest paths from all hubs to all cities in graph.
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |