제출 #813148

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
8131482023-08-07 13:53:51LIF도시들 (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;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

컴파일 시 표준 에러 (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...