Submission #813148

#TimeUsernameProblemLanguageResultExecution timeMemory
813148LIFTowns (IOI15_towns)C++14
0 / 100
11 ms1236 KiB
#include "towns.h" #include<bits/stdc++.h> using namespace std; int dis[1005][1005]; int hubDistance(int N, int sub) { for(int i=0;i<N;i++)dis[i][i] = 0; for(int i=0;i<N;i++) { for(int j=i+1;j<N;j++) { dis[i][j] = getDistance(i,j); dis[j][i] = dis[i][j]; } } int minn = 1e9; int ans1,ans2; for(int i=0;i<N;i++) { int maxn = -1; for(int j=0;j<N;j++)maxn = max(maxn,dis[i][j]); if(maxn <= minn) { minn = maxn; ans1 = minn; ans2 = i; } } if(sub == 1 || sub == 2)return ans1; else return ans2; }

Compilation message (stderr)

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:16:11: warning: 'ans2' may be used uninitialized in this function [-Wmaybe-uninitialized]
   16 |  int ans1,ans2;
      |           ^~~~
#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...