이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "towns.h"
using namespace std;
#define starburst ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//#define int long long
#define pii pair<int,int>
#define pb push_back
/*int dist[110][110];
int getDistance(int i, int j){
return dist[i][j];
}*/
int hubDistance(int n, int sub){
vector<vector<int>> D(n, vector<int>(n, 0));
for(int i = 0; i < n; ++i)
for(int j = i + 1; j < n; ++j)
D[i][j] = D[j][i] = getDistance(i, j);
int lb = 0, R = 2e9;
while(true){
int mn = 2e9;
for(int i = 1; i < n; ++i){
for(int j = i + 1; j < n; ++j){
int k = (D[0][i] + D[0][j] - D[i][j]) / 2;
if(k < mn && k > lb) mn = k;
}
}
if(mn == 2e9) break;
int r = mn;
for(int i = 1; i < n; ++i){
for(int j = i + 1; j < n; ++j){
if(mn == (D[0][i] + D[0][j] - D[i][j]) / 2){
for(int p = 0; p < n; ++p){
if(p == i || p == j) continue;
int d = (D[i][p] + D[j][p] - D[i][j]) / 2;
r = max(r, d);
}
}
}
}
R = min(R, r);
lb = mn;
}
return R;
}
/*void solve(int sub){
int n; cin >> n;
for(int i = 0; i < n; ++i){
for(int j = 0; j < n; ++j){
cin >> dist[i][j];
}
}
cout << hubDistance(n, sub) << '\n';
}
signed main(){
starburst
int t = 1, s; cin >> s >> t;
while(t--) solve(s);
}*/
컴파일 시 표준 에러 (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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |