Submission #126092

#TimeUsernameProblemLanguageResultExecution timeMemory
126092baluteshihTowns (IOI15_towns)C++14
25 / 100
21 ms900 KiB
#include "towns.h" #include <bits/stdc++.h> #define pb push_back #define ET cout << "\n" #define ALL(v) v.begin(),v.end() #define MP make_pair #define F first #define S second #define MEM(i,j) memset(i,j,sizeof i) #define DB(a,s,e) {for(int i=s;i<e;++i) cout << a[i] << " ";ET;} using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; const int INF=1e9; int hubDistance(int N, int sub) { vector<int> dis(N,0),a(N,0),b(N,0); int x,y,R=INF; for(int i=1;i<N;++i) dis[i]=getDistance(0,i); x=max_element(ALL(dis))-dis.begin(); for(int i=0;i<N;++i) if(i!=x) a[i]=getDistance(x,i); y=max_element(ALL(a))-a.begin(); for(int i=0;i<N;++i) if(i!=y) b[i]=getDistance(y,i); for(int i=0;i<N;++i) R=min(R,abs(a[i]-b[i])); return (a[y]+R)/2; }

Compilation message (stderr)

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:24:25: warning: conversion to 'int' from '__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type {aka long int}' may alter its value [-Wconversion]
  x=max_element(ALL(dis))-dis.begin();
    ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
towns.cpp:28:23: warning: conversion to 'int' from '__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type {aka long int}' may alter its value [-Wconversion]
  y=max_element(ALL(a))-a.begin();
    ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
towns.cpp:18:28: warning: unused parameter 'sub' [-Wunused-parameter]
 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...