Submission #553694

#TimeUsernameProblemLanguageResultExecution timeMemory
553694keta_tsimakuridzeTowns (IOI15_towns)C++17
25 / 100
15 ms492 KiB
#include "towns.h" #include<bits/stdc++.h> using namespace std; #define ll long long const int N = 505; ll d[2][N]; int hubDistance(int n, int sub) { int U = 0, V = 0; for(int i = 0; i < n; i++) { d[0][i] = getDistance(0, i); if(d[0][i] >= d[0][U]) U = i; } for(int i = 0; i < n; i++) { d[1][i] = getDistance(U, i); if(d[1][i] >= d[1][V]) V = i; } vector<ll> v; ll Distance = 0; for(int i = 0; i < n; i++) { ll D = (d[1][i] + d[0][i] - d[0][U]) / 2; D = d[1][i] - D; v.push_back(D); if(i == V) Distance = D; } sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end()); ll R = 1e18; for(int i = 0; i < v.size(); i++) { if(v[i] > Distance) break; ll x = (d[1][V] + d[0][V] - d[0][U]) / 2 + Distance - v[i]; R = min(R, max(v[i], x)); } return R; }

Compilation message (stderr)

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:29:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  for(int i = 0; i < v.size(); i++) {
      |                 ~~^~~~~~~~~~
towns.cpp:34:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   34 |  return R;
      |         ^
towns.cpp:7:28: warning: unused parameter 'sub' [-Wunused-parameter]
    7 | 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...