Submission #1037243

#TimeUsernameProblemLanguageResultExecution timeMemory
1037243antonTowns (IOI15_towns)C++17
13 / 100
95 ms1020 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...