Submission #1122110

#TimeUsernameProblemLanguageResultExecution timeMemory
1122110epicci23Towns (IOI15_towns)C++17
0 / 100
22 ms1104 KiB
#include "bits/stdc++.h" #include "towns.h" #define all(v) v.begin() , v.end() #define sz(a) (int)a.size() using namespace std; array<int,3> solve(int ab,int ac,int bc){ int abc = (ab+ac+bc)/2; int a = abc - bc; int b = abc - ac; int c = abc - ab; return {a,b,c}; } int hubDistance(int N, int sub){ int dia1 = 0 , cur = 0; for(int i = 0; i < N ;i++){ int u = getDistance(0, i); if(u > cur){ dia1 = i; cur = u; } } int dia2 = dia1; cur = 0; vector<int> uz1(N,0),uz2(N,0); for(int i = 0; i < N ; i++){ int u = getDistance(dia1, i); uz1[i] = u; if(u > cur){ dia2 = i; cur = u; } } int res = 0; for(int i = 0; i < N; i++) uz2[i] = getDistance(dia2,i); for(int i = 0; i < N; i++){ auto x = solve(cur,uz1[i],uz2[i]); res=max({res,x[0],x[1]}); } return res; }

Compilation message (stderr)

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:15:28: warning: unused parameter 'sub' [-Wunused-parameter]
   15 | 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...