Submission #1037243

# Submission time Handle Problem Language Result Execution time Memory
1037243 2024-07-28T11:18:08 Z anton Towns (IOI15_towns) C++17
13 / 100
95 ms 1020 KB
#include "towns.h"
#include<bits/stdc++.h>

using namespace std;

const int MAX_N= 110;

struct Edge{
	int origin, dest;
	int l;
	Edge(){};
	Edge(int _or, int _de, int _l){
		l = _l;
		origin = _or;
		dest = _de;
	}
};

vector<int>distances[MAX_N];
vector<vector<Edge>> adj;

void addEdge(int a, int b, int l){
	adj[a].push_back(Edge(a, b, l));
	adj[b].push_back(Edge(b, a, l));
}


vector<int> get_pos(int a, int b){
	set<int> cats;

	for(int i = 0; i<adj.size(); i++){
		cats.insert(((distances[a][i]-distances[b][i])+distances[a][b])/2);
	}

	return vector<int>(cats.begin(),cats.end());
}
void build_tree(vector<int> leaves, int root, vector<int> axis, int root_pos){
	
}
int hubDistance(int N, int sub) {
	adj.resize(N);
	for(int i = 0; i<N; i++){
		distances[i].resize(N, 0);
	}
	for(int i = 0; i<N; i++){
		for(int j = i+1; j<N; j++){
			distances[i][j] = getDistance(i, j);
			distances[j][i] = distances[i][j];
		}
	}

	int R = 0;
	for(int i = 0; i<N; i++){
		for(int j = i+1; j<N; j++){
			int dist_total = distances[i][j];
			auto v = get_pos(i, j);
			int pathR = 1e9;
			for(auto mid: v){
				pathR = min(pathR, max(mid,dist_total-mid));
			}
			R = max(pathR, R);

		}
	}

	return R;
}

Compilation message

towns.cpp: In function 'std::vector<int> get_pos(int, int)':
towns.cpp:31:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<Edge> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |  for(int i = 0; i<adj.size(); i++){
      |                 ~^~~~~~~~~~~
towns.cpp: In function 'void build_tree(std::vector<int>, int, std::vector<int>, int)':
towns.cpp:37:29: warning: unused parameter 'leaves' [-Wunused-parameter]
   37 | void build_tree(vector<int> leaves, int root, vector<int> axis, int root_pos){
      |                 ~~~~~~~~~~~~^~~~~~
towns.cpp:37:41: warning: unused parameter 'root' [-Wunused-parameter]
   37 | void build_tree(vector<int> leaves, int root, vector<int> axis, int root_pos){
      |                                     ~~~~^~~~
towns.cpp:37:59: warning: unused parameter 'axis' [-Wunused-parameter]
   37 | void build_tree(vector<int> leaves, int root, vector<int> axis, int root_pos){
      |                                               ~~~~~~~~~~~~^~~~
towns.cpp:37:69: warning: unused parameter 'root_pos' [-Wunused-parameter]
   37 | void build_tree(vector<int> leaves, int root, vector<int> axis, int root_pos){
      |                                                                 ~~~~^~~~~~~~
towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:40:28: warning: unused parameter 'sub' [-Wunused-parameter]
   40 | int hubDistance(int N, int sub) {
      |                        ~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 95 ms 1020 KB Output is correct
2 Correct 60 ms 980 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 71 ms 1008 KB Output is correct
5 Correct 54 ms 856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 59 ms 856 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 456 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -