Submission #1036579

#TimeUsernameProblemLanguageResultExecution timeMemory
1036579vjudge1Towns (IOI15_towns)C++17
0 / 100
11 ms1116 KiB
#include "towns.h" #include<bits/stdc++.h> using namespace std; int n; int dist[200][200]; int query(int i,int j){ if(j<i)swap(i,j); if(!dist[i][j])dist[i][j]=getDistance(i,j); return dist[i][j]; } int hubDistance(int N, int sub) { n=N; int past=-1,point1=-1; for(int i=1;i<n;i++){ if(past<query(0,i)){ point1=i; past=query(0,i); } } past=-1; int point2=-1; for(int i=0;i<n;i++){ if(i==point1)continue; if(past<query(point1,i)){ point2=i; past=query(point1,i); } } int ds=query(point1,point2); int ans=1e9; for(int i=0;i<n;i++){ if(i==point1||i==point2)continue; int tem=(query(point1,i)+query(point2,i)-ds)/2; int val1=query(point1,i)-tem; int val2=query(point2,i)-tem; if(val1<val2)val1=val2; if(val1<ans)ans=val1; } return ans; }

Compilation message (stderr)

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