Submission #1030362

#TimeUsernameProblemLanguageResultExecution timeMemory
1030362pccTowns (IOI15_towns)C++17
0 / 100
1049 ms592 KiB
#include "towns.h" #include <bits/stdc++.h> #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,popcnt,sse4") using namespace std; const int mxn = 120; int dp[mxn][mxn]; int ask(int a,int b){ if(a == b)return dp[a][b] = 0; if(dp[a][b] != -1)return dp[a][b]; else return dp[a][b] = dp[b][a] = getDistance(a,b); } int tocen(int a,int b,int c){ return ((ask(a,b)+ask(a,c)-ask(b,c))>>1); } int hubDistance(int N, int sub) { memset(dp,-1,sizeof(dp)); int ans = 1e9; for(int i = 0;i<N;i++){ for(int j = 0;j<N;j++){ for(int k = 0;k<N;k++){ if(i == j||j == k||i == k)continue; int d1 = tocen(i,j,k); int d2 = tocen(j,i,k); int d3 = tocen(k,i,j); int tans = max({d1,d2,d3}); for(int l = 0;l<N;l++){ if(l == i||l == j||l == k)continue; if(tocen(i,j,l) == d1&&tocen(j,i,l) == d2)tans = max(tans,tocen(l,i,j)); if(tocen(i,k,l) == d1&&tocen(k,i,l) == d3)tans = max(tans,tocen(l,i,k)); if(tocen(j,k,l) == d2&&tocen(k,j,l) == d3)tans = max(tans,tocen(l,j,k)); } ans = min(ans,tans); } } } return ans; }

Compilation message (stderr)

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